bug 1186: Fix warning if no valid MX records are returned for one line of the execute...
authorBenny Baumann <BenBE@geshi.org>
Tue, 2 Jul 2013 22:15:13 +0000 (00:15 +0200)
committerBenny Baumann <BenBE@geshi.org>
Tue, 2 Jul 2013 22:15:13 +0000 (00:15 +0200)
includes/general.php

index bcbe38d..abc8611 100644 (file)
 #echo `dig +short mx heise.de 2>&1`."-<br>\n";
 
                        $list = explode("\n", $line);
-                       foreach($list as $row)
-                               list($pri, $mxhosts[]) = explode(" ", substr(trim($row), 0, -1));
+                       foreach($list as $row) {
+                               if(!strstr(" ", $row)) {
+                                       continue;
+                               }
+                               list($pri, $mxhosts[]) = explode(" ", trim($row), 2);
+                       }
                        $mxhosts[] = $domain;
-#print_r($mxhosts); die;
+                       array_walk($mxhosts, function(&$mx) { $mx = trim($mx); } );
+
                        foreach($mxhosts as $key => $domain)
                        {
                                $fp = @fsockopen($domain,25,$errno,$errstr,5);