From 395fe8cb10de88678e0adccb2dad10686b4b8caa Mon Sep 17 00:00:00 2001 From: Diogo Cordeiro Date: Tue, 21 Jul 2020 12:01:56 +0100 Subject: [PATCH] [ActivityPub] Fix wrong type handling on AProfile:update_profile --- plugins/ActivityPub/classes/Activitypub_profile.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/ActivityPub/classes/Activitypub_profile.php b/plugins/ActivityPub/classes/Activitypub_profile.php index d576d13e69..ee1aedeac8 100644 --- a/plugins/ActivityPub/classes/Activitypub_profile.php +++ b/plugins/ActivityPub/classes/Activitypub_profile.php @@ -489,7 +489,7 @@ class Activitypub_profile extends Managed_DataObject * @throws NoProfileException * @author Diogo Cordeiro */ - public static function update_profile(Activitypub_profile $aprofile, array $res): Profile + public static function update_profile(Activitypub_profile $aprofile, $res): Profile { if ($res === false) { $profile = $aprofile->local_profile(); @@ -498,6 +498,10 @@ class Activitypub_profile extends Managed_DataObject throw new NoProfileException($id, "410 Gone"); } + if (!is_array($res)) { + throw new InvalidArgumentException('TypeError: Argument 2 passed to Activitypub_profile::update_profile() must be of the type array or bool(false).'); + } + // ActivityPub Profile $aprofile->uri = $res['id']; $aprofile->nickname = $res['preferredUsername'];