]> git.mxchange.org Git - friendica.git/commitdiff
Avid notices and warnings (#5546)
authorMichael Vogel <icarus@dabo.de>
Thu, 2 Aug 2018 17:07:20 +0000 (19:07 +0200)
committerTobias Diekershoff <tobias.diekershoff@gmx.net>
Thu, 2 Aug 2018 17:07:20 +0000 (19:07 +0200)
src/Protocol/PortableContact.php
src/Util/Network.php

index aa86a0002a0f5c093bda4c812d84032221537cbf..172991cd3bea0bd008b5a1f0598251d694a31bf3 100644 (file)
@@ -1645,7 +1645,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 +1667,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 +1766,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);
+                                       }
                                }
                        }
                }
index e9e318aa08ae70b0fcbda4d73e124aa1027dcc8c..e3b640fa777a42045554d5295c9330cbab4c6b12 100644 (file)
@@ -494,10 +494,11 @@ class Network
 
                $h = substr($addr, strpos($addr, '@') + 1);
 
-               if (($h) && (dns_get_record($h, DNS_A + DNS_MX) || filter_var($h, FILTER_VALIDATE_IP) )) {
+               // Concerning the @ see here: https://stackoverflow.com/questions/36280957/dns-get-record-a-temporary-server-error-occurred
+               if ($h && (@dns_get_record($h, DNS_A + DNS_MX) || filter_var($h, FILTER_VALIDATE_IP) )) {
                        return true;
                }
-               if (($h) && dns_get_record($h, DNS_CNAME + DNS_MX)) {
+               if ($h && @dns_get_record($h, DNS_CNAME + DNS_MX)) {
                        return true;
                }
                return false;