From 28c3bc945ffaab8ff732486fad5b0f17014a1ac5 Mon Sep 17 00:00:00 2001 From: Vladimir Gorea Date: Thu, 12 Jan 2017 14:40:51 +0200 Subject: [PATCH] Bugfix phpToXml A bugfix for values that have only attributes or are empty (ex: get_list without filters/fields/sort) --- api_util.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api_util.php b/api_util.php index 5441fb8..8552256 100755 --- a/api_util.php +++ b/api_util.php @@ -146,8 +146,9 @@ public static function phpToXml($key, $values) { $firstKey = array_shift($valuekeys); if (is_array($value[$firstKey]) || count($value) > 0 ) { $_xml = self::phpToXml($node,$value) ; - } - else { + } elseif (count($value) == 0) { + $_xml .= "<$node>"; + } else { $_xml = self::phpToXml($node,$value) ; $v = $value[$firstKey]; $_xml .= "<$node>" . htmlspecialchars($v) . "";