From 065e23b1c4dce31f38c2f187be7679066c6f5840 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Mon, 4 Jan 2016 01:58:45 +0100 Subject: [PATCH] Code cleanup in lib/activityutils.php --- lib/activityutils.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/activityutils.php b/lib/activityutils.php index da543b2069..c8e5808251 100644 --- a/lib/activityutils.php +++ b/lib/activityutils.php @@ -392,7 +392,8 @@ class ActivityUtils $object = new Notice(); } } - foreach (array_unique($uris) as $uri) { + $uris = array_unique($uris); + foreach ($uris as $uri) { try { // the exception thrown will cancel before reaching $object $object = call_user_func(array($object, 'fromUri'), $uri); @@ -401,11 +402,10 @@ class ActivityUtils common_debug('Could not find local activity object from uri: '.$e->object_uri); } } - if (!empty($object)) { - Event::handle('EndFindLocalActivityObject', array($object->getUri(), $type, $object)); - } else { - throw new ServerException('Could not find any activityobject stored locally with given URI'); + if (!$object instanceof Managed_DataObject) { + throw new ServerException('Could not find any activityobject stored locally with given URIs: '.var_export($uris,true)); } + Event::handle('EndFindLocalActivityObject', array($object->getUri(), $object->getObjectType(), $object)); return $object; }