From 3e522ed5126a840687c8be56ce0b47f2acff0337 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 21 Jun 2022 01:41:34 +0200 Subject: [PATCH] Fixed: - prevent NULL from being handled over to XML::escape() - still I wonder that an object can be? It is a string-only accepting method --- src/Util/XML.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Util/XML.php b/src/Util/XML.php index 76947e9431..734fd9298a 100644 --- a/src/Util/XML.php +++ b/src/Util/XML.php @@ -56,7 +56,7 @@ class XML $root = new SimpleXMLElement('<' . $key . '/>'); self::fromArray($value, $root, $remove_header, $namespaces, false); } else { - $root = new SimpleXMLElement('<' . $key . '>'.self::escape($value).''); + $root = new SimpleXMLElement('<' . $key . '>' . self::escape($value ?? '') . ''); } $dom = dom_import_simplexml($root)->ownerDocument; @@ -124,7 +124,7 @@ class XML } if (!is_array($value)) { - $element = $xml->addChild($key, self::escape($value), $namespace); + $element = $xml->addChild($key, self::escape($value ?? ''), $namespace); } elseif (is_array($value)) { $element = $xml->addChild($key, null, $namespace); self::fromArray($value, $element, $remove_header, $namespaces, false); -- 2.39.5