Skip to content
Merged
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
3 changes: 3 additions & 0 deletions Zend/tests/gh21504.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

'1234' |> var_dump(...);
12 changes: 12 additions & 0 deletions Zend/tests/gh21504.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--TEST--
GH-21504: Incorrect RC-handling for ZEND_EXT_STMT op1
--FILE--
<?php

$php_escaped = getenv('TEST_PHP_EXECUTABLE_ESCAPED');
$cmd = $php_escaped . ' -n -e ' . escapeshellarg(__DIR__ . '/gh21504.inc');
echo shell_exec($cmd);

?>
--EXPECT--
string(4) "1234"
3 changes: 3 additions & 0 deletions Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1950,6 +1950,9 @@ static void zend_do_extended_stmt(znode* result) /* {{{ */

opline->opcode = ZEND_EXT_STMT;
if (result) {
if (result->op_type == IS_CONST) {
Z_TRY_ADDREF(result->u.constant);
}
SET_NODE(opline->op1, result);
}
}
Expand Down
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>