aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/lib/database.php2
-rw-r--r--engine/lib/entities.php17
-rw-r--r--languages/en.php3
-rw-r--r--mod/guidbrowser/views/default/guidbrowser/entity_full.php6
4 files changed, 17 insertions, 11 deletions
diff --git a/engine/lib/database.php b/engine/lib/database.php
index 62fa15877..d3113e202 100644
--- a/engine/lib/database.php
+++ b/engine/lib/database.php
@@ -148,7 +148,7 @@
if (!empty($callback) && is_callable($callback)) {
$row = $callback($row);
}
- $resultarray[] = $row;
+ if ($row) $resultarray[] = $row;
}
}
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
{
diff --git a/languages/en.php b/languages/en.php
index 2fead89ed..1e2b6dd91 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -56,7 +56,8 @@
'InvalidParameterException:UnexpectedODDClass' => "import() passed an unexpected ODD class",
'InvalidParameterException:EntityTypeNotSet' => "Entity type must be set.",
- 'ClassException:ClassnameNotClass' => "%s is not a %s.",
+ 'ClassException:ClassnameNotClass' => "%s is not a %s.",
+ 'ClassNotFoundException:MissingClass' => "Class '%s' was not found, missing plugin?",
'InstallationException:TypeNotSupported' => "Type %s is not supported. This indicates an error in your installation, most likely caused by an incomplete upgrade.",
'ImportException:ImportFailed' => "Could not import element %d",
diff --git a/mod/guidbrowser/views/default/guidbrowser/entity_full.php b/mod/guidbrowser/views/default/guidbrowser/entity_full.php
index 47c6adeb2..62dd78264 100644
--- a/mod/guidbrowser/views/default/guidbrowser/entity_full.php
+++ b/mod/guidbrowser/views/default/guidbrowser/entity_full.php
@@ -35,7 +35,7 @@
<div id="metadata">
<h2>Metadata</h2>
<?php
- foreach ($metadata as $m)
+ if ($metadata) foreach ($metadata as $m)
{
?>
<div>
@@ -66,7 +66,7 @@
<div id="annotations">
<h2>Annotations</h2>
<?php
- foreach ($annotations as $a)
+ if ($annotations) foreach ($annotations as $a)
{
?>
<div>
@@ -96,7 +96,7 @@
<div id="relationship">
<h2>Relationships</h2>
<?php
- foreach ($relationships as $r)
+ if ($relationships) foreach ($relationships as $r)
{
?>
<div>