From 2722c8e595e61341e6a475972b09fff75aaf1ac0 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 7 Mar 2020 11:16:10 +0000 Subject: [PATCH] Some systems return an array instead of a string for the followers/following --- src/Model/GContact.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Model/GContact.php b/src/Model/GContact.php index ee30cf3c59..a13b719a9c 100644 --- a/src/Model/GContact.php +++ b/src/Model/GContact.php @@ -1326,7 +1326,16 @@ class GContact DBA::update('gfollower', ['deleted' => true], ['gcid' => $gcid]); } - $contacts = array_unique(array_merge($followers, $followings)); + $contacts = []; + foreach (array_merge($followers, $followings) as $contact) { + if (is_string($contact)) { + $contacts[] = $contact; + } elseif (!empty($contact['url']) && is_string($contact['url'])) { + $contacts[] = $contact['url']; + } + } + $contacts = array_unique($contacts); + Logger::info('Discover AP contacts', ['url' => $url, 'contacts' => count($contacts)]); foreach ($contacts as $contact) { $gcontact = DBA::selectFirst('gcontact', ['id'], ['nurl' => Strings::normaliseLink(($contact))]); -- 2.39.5