From: Mikael Nordfeldth Date: Mon, 4 Jan 2016 00:58:45 +0000 (+0100) Subject: Code cleanup in lib/activityutils.php X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=065e23b1c4dce31f38c2f187be7679066c6f5840;p=quix0rs-gnu-social.git Code cleanup in lib/activityutils.php --- 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; }