From f5a4f067919515186730a509dd6ea8736026f624 Mon Sep 17 00:00:00 2001 From: SecretR Date: Thu, 16 May 2013 13:19:17 +0300 Subject: [PATCH] Better handling of empty values (XML handler) --- e107_handlers/xml_class.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/e107_handlers/xml_class.php b/e107_handlers/xml_class.php index 58fd7803c..4a0a052b6 100644 --- a/e107_handlers/xml_class.php +++ b/e107_handlers/xml_class.php @@ -560,7 +560,16 @@ class xmlClass //more cases? default: - + // fix - empty SimpleXMLElement + if(empty($xml->{$tag})) + { + if($this->arrayTags && in_array($tag, $this->arrayTags)) + { + $ret[$tag] = array(); + } + else $ret[$tag] = ''; + break; + } $count = count($xml->{$tag}); if($count >= 1) //array of elements - loop { @@ -703,8 +712,7 @@ class xmlClass continue; } - - + if(isset($vars[$vl]) && is_array($vars[$vl]) && !varset($vars[$vl][0])) {