]> git.mxchange.org Git - friendica.git/commitdiff
Some systems return an array instead of a string for the followers/following
authorMichael <heluecht@pirati.ca>
Sat, 7 Mar 2020 11:16:10 +0000 (11:16 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 7 Mar 2020 11:16:10 +0000 (11:16 +0000)
src/Model/GContact.php

index ee30cf3c590028eca55cf1ba27ed5b2f69af0ff2..a13b719a9c3aae252083e2f7ab78dbb2795eeafc 100644 (file)
@@ -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))]);