]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
A bit safer checking in the keypair parsing
authorJames Walker <walkah@walkah.net>
Wed, 24 Mar 2010 18:27:35 +0000 (14:27 -0400)
committerJames Walker <walkah@walkah.net>
Wed, 24 Mar 2010 18:27:35 +0000 (14:27 -0400)
plugins/OStatus/lib/magicenvelope.php

index 9266cab5cf40351de6f7949212fc10ec061a9645..799b5e307961a840fc04f8be975f2f67536d560d 100644 (file)
@@ -59,12 +59,21 @@ class MagicEnvelope
         }
         if ($xrd->links) {
             if ($link = Discovery::getService($xrd->links, Magicsig::PUBLICKEYREL)) {
-                list($type, $keypair) = explode(',', $link['href']);
-                if (empty($keypair)) {
+                $keypair = false;
+                $parts = explode(',', $link['href']);
+                if (count($parts) == 2) {
+                    $keypair = $parts[1];
+                } else {
                     // Backwards compatibility check for separator bug in 0.9.0
-                    list($type, $keypair) = explode(';', $link['href']);
+                    $parts = explode(';', $link['href']);
+                    if (count($parts) == 2) {
+                        $keypair = $parts[1];
+                    }
+                }
+                
+                if ($keypair) {
+                    return $keypair;
                 }
-                return $keypair;
             }
         }
         throw new Exception('Unable to locate signer public key');