Don't spew XML parse warnings to output when checking a remote XRD page

This commit is contained in:
Brion Vibber 2010-03-23 14:18:45 -07:00
parent 7dc24b4ca7
commit 5f32cf32cd

View File

@ -53,7 +53,14 @@ class XRD
$xrd = new XRD(); $xrd = new XRD();
$dom = new DOMDocument(); $dom = new DOMDocument();
if (!$dom->loadXML($xml)) {
// Don't spew XML warnings to output
$old = error_reporting();
error_reporting($old & ~E_WARNING);
$ok = $dom->loadXML($xml);
error_reporting($old);
if (!$ok) {
throw new Exception("Invalid XML"); throw new Exception("Invalid XML");
} }
$xrd_element = $dom->getElementsByTagName('XRD')->item(0); $xrd_element = $dom->getElementsByTagName('XRD')->item(0);