Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/dom/node.c
Original file line number Diff line number Diff line change
Expand Up @@ -2132,7 +2132,7 @@ static void dom_relink_ns_decls_element(HashTable *links, xmlNodePtr node)

ns->_private = attr;
if (attr->prev) {
attr->prev = attr->next;
attr->prev->next = attr->next;
} else {
node->properties = attr->next;
}
Expand Down
17 changes: 17 additions & 0 deletions ext/dom/tests/modern/xml/gh21548.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--TEST--
GH-21548 (Dom\XMLDocument::C14N() emits duplicate xmlns declarations after setAttributeNS())
--CREDITS--
Toon Verwerft (veewee)
--EXTENSIONS--
dom
--FILE--
<?php

$doc = Dom\XMLDocument::createFromString('<root xmlns="urn:a" attr="val"/>');
$doc->documentElement->setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:ns1", "urn:a");

echo $doc->C14N() . PHP_EOL;

?>
--EXPECT--
<root xmlns="urn:a" xmlns:ns1="urn:a" attr="val"></root>
Loading