From c95229da576cfcc1e06dfa2281510921e2c7ff77 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Mon, 5 Oct 2009 01:24:37 +0000 Subject: #391264 by mfb and dww: Added exception handling to Update module XML parsing. --- modules/update/update.fetch.inc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/update/update.fetch.inc b/modules/update/update.fetch.inc index 82a078444..80d3d5352 100644 --- a/modules/update/update.fetch.inc +++ b/modules/update/update.fetch.inc @@ -189,7 +189,15 @@ function _update_cron_notify() { function update_parse_xml($raw_xml_list) { $data = array(); foreach ($raw_xml_list as $raw_xml) { - $xml = new SimpleXMLElement($raw_xml); + try { + $xml = new SimpleXMLElement($raw_xml); + } + catch (Exception $e) { + // SimpleXMLElement::__construct produces an E_WARNING error message for + // each error found in the XML data and throws an exception if errors + // were detected. Catch any exception and break to the next XML string. + break; + } $short_name = (string)$xml->short_name; $data[$short_name] = array(); foreach ($xml as $k => $v) { -- cgit v1.2.3