Skip to content

Commit 04a8140

Browse files
committed
Fix GH-16473: dom_import_simplexml stub is wrong
It's been wrong since PHP 8.0 at least, and the signature was inherited in 8.4-dev to the new DOM methods.
1 parent 6a8d0a0 commit 04a8140

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

ext/dom/php_dom.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,4 +933,4 @@ public function registerPhpFunctions(string|array|null $restrict = null): void {
933933
}
934934
#endif
935935

936-
function dom_import_simplexml(object $node): DOMElement {}
936+
function dom_import_simplexml(object $node): DOMAttr|DOMElement {}

ext/dom/php_dom_arginfo.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/dom/tests/gh16473.phpt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
GH-16473 (dom_import_simplexml stub is wrong)
3+
--EXTENSIONS--
4+
dom
5+
--FILE--
6+
<?php
7+
$root = simplexml_load_string('<root xmlns:x="urn:x" x:attr="foo"/>');
8+
$spattr = $root->attributes('urn:x');
9+
var_dump(dom_import_simplexml($spattr)->textContent);
10+
?>
11+
--EXPECT--
12+
string(3) "foo"

0 commit comments

Comments
 (0)