OStatus: catchable exception instead of fatal when parsing valid XML that isn't a valid XRD doc

This commit is contained in:
Brion Vibber 2010-03-03 18:31:35 -08:00
parent 14065ca350
commit 24835c1164
1 changed files with 3 additions and 0 deletions

View File

@ -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);