From bdf3548de32dc7305de6b93a47c6adb5c99c9878 Mon Sep 17 00:00:00 2001 From: Ivan Peevski <133036+ipeevski@users.noreply.github.com> Date: Wed, 11 Sep 2024 09:32:43 +0930 Subject: [PATCH] Fix handling null in to_xml() --- src/Format.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Format.php b/src/Format.php index 54dc4c46..4c55a430 100644 --- a/src/Format.php +++ b/src/Format.php @@ -215,7 +215,7 @@ public function to_xml($data = null, $structure = null, $basenode = 'xml') $this->to_xml($value, $node, $key); } else { // add single node. - $value = htmlspecialchars(html_entity_decode($value, ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8'); + $value = htmlspecialchars(html_entity_decode($value ?? '', ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8'); $structure->addChild($key, $value); }