From: Roland Häder Date: Mon, 20 Jun 2022 23:41:34 +0000 (+0200) Subject: Fixed: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3e522ed5126a840687c8be56ce0b47f2acff0337;p=friendica.git 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 --- 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);