From 5f32cf32cd7d4a5df7ba64d4f1e7d9edee8d418c Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 23 Mar 2010 14:18:45 -0700 Subject: [PATCH] Don't spew XML parse warnings to output when checking a remote XRD page --- plugins/OStatus/lib/xrd.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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);