]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/PortableContact.php
Added logging and one more reason for a notice found (#5538)
[friendica.git] / src / Protocol / PortableContact.php
index 21cb325bddcd56ff52c959c71a9d4b8b0fefc2c6..aa86a0002a0f5c093bda4c812d84032221537cbf 100644 (file)
@@ -659,6 +659,10 @@ class PortableContact
                $nodeinfo2_url = '';
 
                foreach ($nodeinfo['links'] as $link) {
+                       if (!is_array($link) || empty($link['rel'])) {
+                               logger('Invalid nodeinfo format for ' . $server_url, LOGGER_DEBUG);
+                               continue;
+                       }
                        if ($link['rel'] == 'http://nodeinfo.diaspora.software/ns/schema/1.0') {
                                $nodeinfo1_url = $link['href'];
                        } elseif ($link['rel'] == 'http://nodeinfo.diaspora.software/ns/schema/2.0') {
@@ -1544,7 +1548,7 @@ class PortableContact
                }
 
                foreach ($serverlist as $server) {
-                       $server_url = str_replace("/index.php", "", $server['url'];
+                       $server_url = str_replace("/index.php", "", $server['url']);
 
                        $r = q("SELECT `nurl` FROM `gserver` WHERE `nurl` = '%s'", DBA::escape(normalise_link($server_url)));
 
@@ -1638,7 +1642,7 @@ class PortableContact
 
                $retdata = Network::curl($url);
 
-               if ($retdata["success"]) {
+               if ($retdata["success"] && !empty($retdata["body"])) {
                        $data = json_decode($retdata["body"], true);
 
                        self::discoverServer($data, 2);
@@ -1659,7 +1663,7 @@ class PortableContact
 
                                $retdata = Network::curl($url);
 
-                               if ($retdata["success"]) {
+                               if ($retdata["success"] && !empty($retdata["body"])) {
                                        logger("Fetch all global contacts from the server " . $server["nurl"], LOGGER_DEBUG);
                                        $success = self::discoverServer(json_decode($retdata["body"], true));
                                }