]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/PortableContact.php
Issue 5436: Don't store tags that are too long
[friendica.git] / src / Protocol / PortableContact.php
index aa86a0002a0f5c093bda4c812d84032221537cbf..a94affd0470398e8f898ba66cb51147ca04a1eb4 100644 (file)
@@ -1471,7 +1471,9 @@ class PortableContact
                        $tags = [];
                        foreach ($data['tags'] as $tag) {
                                $tag = mb_strtolower($tag);
-                               $tags[$tag] = $tag;
+                               if (count($tag) < 100) {
+                                       $tags[$tag] = $tag;
+                               }
                        }
 
                        foreach ($tags as $tag) {
@@ -1645,7 +1647,9 @@ class PortableContact
                if ($retdata["success"] && !empty($retdata["body"])) {
                        $data = json_decode($retdata["body"], true);
 
-                       self::discoverServer($data, 2);
+                       if (!empty($data)) {
+                               self::discoverServer($data, 2);
+                       }
 
                        if (Config::get('system', 'poco_discovery') > 1) {
                                $timeframe = Config::get('system', 'poco_discovery_since');
@@ -1665,7 +1669,11 @@ class PortableContact
 
                                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));
+                                       $data = json_decode($retdata["body"], true);
+
+                                       if (!empty($data)) {
+                                               $success = self::discoverServer($data);
+                                       }
                                }
 
                                if (!$success && (Config::get('system', 'poco_discovery') > 2)) {
@@ -1760,7 +1768,11 @@ class PortableContact
                                $retdata = Network::curl($url);
 
                                if (!empty($retdata['success'])) {
-                                       self::discoverServer(json_decode($retdata['body'], true), 3);
+                                       $data = json_decode($retdata["body"], true);
+
+                                       if (!empty($data)) {
+                                               self::discoverServer($data, 3);
+                                       }
                                }
                        }
                }