summaryrefslogtreecommitdiff
path: root/plugins/OStatus/lib/xrd.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-03-04 06:07:28 -0800
committerBrion Vibber <brion@pobox.com>2010-03-04 06:07:28 -0800
commitb218aee94e581230e1efa14d4ae1a19756986ddf (patch)
treea832ddf3b4322b520fd20c4d8ea2d31720c3679b /plugins/OStatus/lib/xrd.php
parent358556057a87c0cb9291223a2026782e6548ff2e (diff)
parent14d7f4a598d0e24467fe3eafd9a02b0e651edad8 (diff)
Merge commit 'origin/testing' into 0.9.x
Conflicts: lib/action.php lib/adminpanelaction.php
Diffstat (limited to 'plugins/OStatus/lib/xrd.php')
-rw-r--r--plugins/OStatus/lib/xrd.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/plugins/OStatus/lib/xrd.php b/plugins/OStatus/lib/xrd.php
index 85df26c54..aa13ef024 100644
--- a/plugins/OStatus/lib/xrd.php
+++ b/plugins/OStatus/lib/xrd.php
@@ -57,6 +57,9 @@ class XRD
throw new Exception("Invalid XML");
}
$xrd_element = $dom->getElementsByTagName('XRD')->item(0);
+ if (!$xrd_element) {
+ throw new Exception("Invalid XML, missing XRD root");
+ }
// Check for host-meta host
$host = $xrd_element->getElementsByTagName('Host')->item(0);
@@ -149,9 +152,11 @@ class XRD
$link['href'] = $element->getAttribute('href');
$link['template'] = $element->getAttribute('template');
foreach ($element->childNodes as $node) {
- switch($node->tagName) {
- case 'Title':
- $link['title'][] = $node->nodeValue;
+ if ($node instanceof DOMElement) {
+ switch($node->tagName) {
+ case 'Title':
+ $link['title'][] = $node->nodeValue;
+ }
}
}