From 5cbec9c6ab17e320c58a259f0cebe88bde4a7c46 Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Mon, 26 Dec 2022 04:22:07 -0400 Subject: [PATCH] Backport changes from spatie/array-to-xml#204 (#206) --- src/ArrayToXml.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ArrayToXml.php b/src/ArrayToXml.php index 8eba571..4a0a457 100644 --- a/src/ArrayToXml.php +++ b/src/ArrayToXml.php @@ -241,7 +241,7 @@ protected function isArrayAllKeySequential($value) protected function addAttributes(DOMElement $element, array $data) { foreach ($data as $attrKey => $attrVal) { - $element->setAttribute($attrKey, $attrVal); + $element->setAttribute($attrKey, $attrVal ?? ''); } }