From 6cd8f679853ee54af8ff62a6837663e0208ff159 Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 3 Nov 2021 09:30:58 -0600 Subject: [PATCH] Try to avoid "PHP Warning: DOMDocument::loadXML(): Empty string supplied as input" --- .../inc/class.importexport_arrayxml.inc.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/importexport/inc/class.importexport_arrayxml.inc.php b/importexport/inc/class.importexport_arrayxml.inc.php index 7247eceb5c..23f041eeec 100644 --- a/importexport/inc/class.importexport_arrayxml.inc.php +++ b/importexport/inc/class.importexport_arrayxml.inc.php @@ -74,15 +74,26 @@ class importexport_arrayxml { * @param string $_xml * @return array */ - public static function xml2array( $_xml ) { - if ( $_xml instanceof DOMElement ) { + public static function xml2array( $_xml ) + { + if($_xml instanceof DOMElement) + { $n = &$_xml; - } else { + } + elseif($_xml) + { $n = new DOMDocument; $loaded = $n->loadXML($_xml); - if(!$loaded) return array(); + if(!$loaded) + { + return array(); + } } $xml_array = array(); + if(!$_xml || !$n) + { + return $xml_array; + } foreach($n->childNodes as $nc) {