From b41547f4f8cfbeb978b5dd11ad5c3f6ee5e0a726 Mon Sep 17 00:00:00 2001 From: Michael van Schaik Date: Mon, 27 Nov 2017 16:34:44 +0100 Subject: [PATCH] Check if DataObject before calling ORM/::get() on class A shortcode may have an id attribute without necessarily representing a database record, hence we should check first. --- src/Controller/ShortcodableController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Controller/ShortcodableController.php b/src/Controller/ShortcodableController.php index e65118e..e0ccd74 100644 --- a/src/Controller/ShortcodableController.php +++ b/src/Controller/ShortcodableController.php @@ -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);