Skip to content

Commit

Permalink
Fix empty namespace issue
Browse files Browse the repository at this point in the history
  • Loading branch information
veewee committed Feb 11, 2022
1 parent 0dc864f commit e5e05cf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Xml/Encoding/Internal/Decoder/Builder/namespaces.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ function namespaces(DOMElement $element): array
return filter([
'@namespaces' => xmlns_attributes_list($element)->reduce(
static fn (array $namespaces, DOMNameSpaceNode $node)
=> merge($namespaces, [(string) $node->prefix => $node->namespaceURI]),
=> $node->namespaceURI
? merge($namespaces, [(string) $node->prefix => $node->namespaceURI])
: $namespaces,
[]
),
]);
Expand Down

0 comments on commit e5e05cf

Please sign in to comment.