Fix a bunch of notice & warning-level messages that were breaking my inter-instance communications

This commit is contained in:
Brion Vibber 2010-03-01 16:35:36 -08:00
parent 7175e7c7a1
commit 8da1b71d69
4 changed files with 13 additions and 6 deletions

View 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');

View 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;
}
}

View 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'];

View 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;