From e4efddbabb26c45348abdb0b03b034d7b2920c0d Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 14 Jun 2019 02:58:40 +0000 Subject: [PATCH] Avoid a notice in AP Receiver --- src/Protocol/ActivityPub/Receiver.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Protocol/ActivityPub/Receiver.php b/src/Protocol/ActivityPub/Receiver.php index 97bd7dc7e7..99142b50ec 100644 --- a/src/Protocol/ActivityPub/Receiver.php +++ b/src/Protocol/ActivityPub/Receiver.php @@ -194,6 +194,11 @@ class Receiver return []; } + if (!is_string($object_id)) { + Logger::info('Invalid object id', ['object' => $object_id]); + return []; + } + $object_type = self::fetchObjectType($activity, $object_id, $uid); // Fetch the content only on activities where this matters @@ -779,7 +784,7 @@ class Receiver if ($type == 'as:Announce') { $object_id = JsonLD::fetchElement($object, 'object', '@id'); - if (empty($object_id)) { + if (empty($object_id) || !is_string($object_id)) { return false; } return self::fetchObject($object_id, [], false, $uid);