Skip to content

Commit 55aa5f3

Browse files
committed
Fix GH-15910: Assertion failure in ext/dom/element.c
1 parent c65e042 commit 55aa5f3

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ PHP NEWS
55
- DOM:
66
. Fix XML serializer errata: xmlns="" serialization should be allowed.
77
(nielsdos)
8+
. Fixed bug GH-15910 (Assertion failure in ext/dom/element.c). (nielsdos)
89

910
- MBString:
1011
. Fixed bug GH-15824 (mb_detect_encoding(): Argument $encodings contains

ext/dom/element.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ static void dom_element_set_attribute_node_common(INTERNAL_FUNCTION_PARAMETERS,
683683
dom_object *intern, *attrobj, *oldobj;
684684

685685
id = ZEND_THIS;
686-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &node, dom_get_node_ce(modern)) == FAILURE) {
686+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &node, dom_get_attr_ce(modern)) == FAILURE) {
687687
RETURN_THROWS();
688688
}
689689

ext/dom/tests/gh15910.phpt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
GH-15910 (Assertion failure in ext/dom/element.c)
3+
--EXTENSIONS--
4+
dom
5+
--CREDITS--
6+
YuanchengJiang
7+
--FILE--
8+
<?php
9+
$doc = new DOMDocument();
10+
$doc->appendChild($doc->createElement('container'));
11+
try {
12+
$doc->documentElement->setAttributeNodeNS($doc);
13+
} catch (Error $e) {
14+
echo $e->getMessage(), "\n";
15+
}
16+
?>
17+
--EXPECT--
18+
DOMElement::setAttributeNodeNS(): Argument #1 ($attr) must be of type DOMAttr, DOMDocument given

0 commit comments

Comments
 (0)