Yaron Koren has submitted this change and it was merged.

Change subject: Added try...catch block for XML parsing with "use xpath"
......................................................................


Added try...catch block for XML parsing with "use xpath"

Change-Id: I598411077799379b1a2c2a1673318a3a57995552
---
M ED_Utils.php
1 file changed, 5 insertions(+), 1 deletion(-)

Approvals:
  Yaron Koren: Checked; Looks good to me, approved



diff --git a/ED_Utils.php b/ED_Utils.php
index d53acb0..6411623 100644
--- a/ED_Utils.php
+++ b/ED_Utils.php
@@ -535,8 +535,12 @@
        static function getXPathData( $xml, $mappings, $ns ) {
                global $edgXMLValues;
 
+               try {
+                       $sxml = new SimpleXMLElement( $xml );
+               } catch ( Exception $e ) {
+                       return "Caught exception parsing XML: " . 
$e->getMessage();
+               }
                $edgXMLValues = array();
-               $sxml = new SimpleXMLElement( $xml );
 
                foreach ( $mappings as $local_var => $xpath ) {
                        // First, register any necessary XML namespaces, to

-- 
To view, visit https://gerrit.wikimedia.org/r/185790
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I598411077799379b1a2c2a1673318a3a57995552
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ExternalData
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <[email protected]>
Gerrit-Reviewer: Yaron Koren <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to