diff options
Diffstat (limited to 'engine/lib/entities.php')
-rw-r--r-- | engine/lib/entities.php | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php index 998b996de..7266ed723 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -962,12 +962,17 @@ $classname = get_subtype_class_from_id($row->subtype); if ($classname!="") { - $tmp = new $classname($row); - - if (!($tmp instanceof ElggEntity)) - throw new ClassException(sprintf(elgg_echo('ClassException:ClassnameNotClass'), $classname, get_class())); - - return $tmp; + if (class_exists($classname)) + { + $tmp = new $classname($row); + + if (!($tmp instanceof ElggEntity)) + throw new ClassException(sprintf(elgg_echo('ClassException:ClassnameNotClass'), $classname, get_class())); + + return $tmp; + } + else + error_log(sprintf(elgg_echo('ClassNotFoundException:MissingClass'), $classname)); } else { |