]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Fix a bunch of notice & warning-level messages that were breaking my inter-instance...
authorBrion Vibber <brion@pobox.com>
Tue, 2 Mar 2010 00:35:36 +0000 (16:35 -0800)
committerBrion Vibber <brion@pobox.com>
Tue, 2 Mar 2010 00:35:36 +0000 (16:35 -0800)
plugins/OStatus/classes/Magicsig.php
plugins/OStatus/classes/Ostatus_profile.php
plugins/OStatus/lib/discovery.php
plugins/OStatus/lib/xrd.php

index 96900d876144c80c20e37100bf8f1498390ee876..5a46aeeb6e5f79b8b6ce59fab283685b51521d42 100644 (file)
@@ -146,8 +146,10 @@ class Magicsig extends Memcached_DataObject
         
         $mod = base64_url_decode($matches[1]);
         $exp = base64_url_decode($matches[2]);
-        if ($matches[4]) {
+        if (!empty($matches[4])) {
             $private_exp = base64_url_decode($matches[4]);
+        } else {
+            $private_exp = false;
         }
 
         $params['public_key'] = new Crypt_RSA_KEY($mod, $exp, 'public');
index 7b1aec76baa7eac9b73879b108b7e10a8eee85ff..93e8934c9e8d388ca9319afd6b32c5890f0a88eb 100644 (file)
@@ -1145,7 +1145,7 @@ class Ostatus_profile extends Memcached_DataObject
 
         if (!empty($poco)) {
             $url = $poco->getPrimaryURL();
-            if ($url->type == 'homepage') {
+            if ($url && $url->type == 'homepage') {
                 $homepage = $url->value;
             }
         }
index 388df0a28feed184d48df8a1887fb7bc0c5a3044..f8449b309ec11bda481710af91b803118921f89c 100644 (file)
@@ -94,7 +94,7 @@ class Discovery
             $links = call_user_func(array($class, 'discover'), $uri);
             if ($link = Discovery::getService($links, Discovery::LRDD_REL)) {
                 // Load the LRDD XRD
-                if ($link['template']) {
+                if (!empty($link['template'])) {
                     $xrd_uri = Discovery::applyTemplate($link['template'], $uri);
                 } else {
                     $xrd_uri = $link['href'];
index 16d27f8eb7f66072d24f1f5b98ba8606d85c9563..1de065db9fa643e9fc32bd7eee3fdf8fb0c8534b 100644 (file)
@@ -53,17 +53,22 @@ class XRD
         $xrd = new XRD();
 
         $dom = new DOMDocument();
-        $dom->loadXML($xml);
+        if (!$dom->loadXML($xml)) {
+            throw new Exception("Invalid XML");
+        }
         $xrd_element = $dom->getElementsByTagName('XRD')->item(0);
 
         // Check for host-meta host
-        $host = $xrd_element->getElementsByTagName('Host')->item(0)->nodeValue;
+        $host = $xrd_element->getElementsByTagName('Host')->item(0);
         if ($host) {
-            $xrd->host = $host;
+            $xrd->host = $host->nodeValue;
         }
 
         // Loop through other elements
         foreach ($xrd_element->childNodes as $node) {
+            if (!($node instanceof DOMElement)) {
+                continue;
+            }
             switch ($node->tagName) {
             case 'Expires':
                 $xrd->expires = $node->nodeValue;