Don't spew XML parse warnings to output when checking a remote XRD page
This commit is contained in:
parent
7dc24b4ca7
commit
5f32cf32cd
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user