[ActivityPub] Fix wrong type handling on AProfile:update_profile
This commit is contained in:
parent
f1b3db8e59
commit
05790c124c
|
@ -489,7 +489,7 @@ class Activitypub_profile extends Managed_DataObject
|
|||
* @throws NoProfileException
|
||||
* @author Diogo Cordeiro <diogo@fc.up.pt>
|
||||
*/
|
||||
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'];
|
||||
|
|
Loading…
Reference in New Issue
Block a user