diff --git a/NEWS b/NEWS index 0472345f2ab..d5cd09f0639 100644 --- a/NEWS +++ b/NEWS @@ -32,6 +32,7 @@ PHP NEWS (nielsdos) . Fixed bug GH-16336 (Attribute intern document mismanagement). (nielsdos) . Fixed bug GH-16338 (Null-dereference in ext/dom/node.c). (nielsdos) + . Fixed bug GH-16473 (dom_import_simplexml stub is wrong). (nielsdos) - EXIF: . Fixed bug GH-16409 (Segfault in exif_thumbnail when not dealing with a diff --git a/ext/dom/php_dom.stub.php b/ext/dom/php_dom.stub.php index 0f7f7484104..f46550a012c 100644 --- a/ext/dom/php_dom.stub.php +++ b/ext/dom/php_dom.stub.php @@ -1234,7 +1234,7 @@ namespace } #endif - function dom_import_simplexml(object $node): DOMElement {} + function dom_import_simplexml(object $node): DOMAttr|DOMElement {} } namespace Dom @@ -2168,5 +2168,5 @@ namespace Dom } #endif - function import_simplexml(object $node): Element {} + function import_simplexml(object $node): Attr|Element {} } diff --git a/ext/dom/php_dom_arginfo.h b/ext/dom/php_dom_arginfo.h index e1f230ccbcf..1481c39bc1e 100644 --- a/ext/dom/php_dom_arginfo.h +++ b/ext/dom/php_dom_arginfo.h @@ -1,11 +1,11 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: b79ad2b70757f7d65a6b4fd907222a4955264bf6 */ + * Stub hash: 55ab8f866af63bd2edf96839d35bc8aba88e37ca */ -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_dom_import_simplexml, 0, 1, DOMElement, 0) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_dom_import_simplexml, 0, 1, DOMAttr|DOMElement, 0) ZEND_ARG_TYPE_INFO(0, node, IS_OBJECT, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_Dom_import_simplexml, 0, 1, Dom\\Element, 0) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_Dom_import_simplexml, 0, 1, Dom\\Attr|Dom\\Element, 0) ZEND_ARG_TYPE_INFO(0, node, IS_OBJECT, 0) ZEND_END_ARG_INFO() diff --git a/ext/dom/tests/gh16473.phpt b/ext/dom/tests/gh16473.phpt new file mode 100644 index 00000000000..f4f7308ca90 --- /dev/null +++ b/ext/dom/tests/gh16473.phpt @@ -0,0 +1,13 @@ +--TEST-- +GH-16473 (dom_import_simplexml stub is wrong) +--EXTENSIONS-- +dom +simplexml +--FILE-- +'); +$attr = $root->attributes('urn:x'); +var_dump(dom_import_simplexml($attr)->textContent); +?> +--EXPECT-- +string(3) "foo"