Skip to content

Commit

Permalink
Check if DataObject before calling ORM/::get() on class
Browse files Browse the repository at this point in the history
A shortcode may have an id attribute without necessarily representing a database record, hence we should check first.
  • Loading branch information
micschk authored Nov 27, 2017
1 parent 98884c6 commit b41547f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Controller/ShortcodableController.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public function shortcodePlaceHolder($request)
return;
}

if ($id) {
if ($id && is_subclass_of($classname, 'DataObject')) {
$object = $classname::get()->byID($id);
} else {
$object = singleton($classname);
Expand Down

0 comments on commit b41547f

Please sign in to comment.