From: Brion Vibber Date: Tue, 23 Mar 2010 21:18:45 +0000 (-0700) Subject: Don't spew XML parse warnings to output when checking a remote XRD page X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5f32cf32cd7d4a5df7ba64d4f1e7d9edee8d418c;p=quix0rs-gnu-social.git Don't spew XML parse warnings to output when checking a remote XRD page --- diff --git a/plugins/OStatus/lib/xrd.php b/plugins/OStatus/lib/xrd.php index aa13ef0242..34b28790b7 100644 --- a/plugins/OStatus/lib/xrd.php +++ b/plugins/OStatus/lib/xrd.php @@ -53,7 +53,14 @@ class XRD $xrd = new XRD(); $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"); } $xrd_element = $dom->getElementsByTagName('XRD')->item(0);