Closed
Description
Description
The following code:
<?php
$root = simplexml_load_string('<?xml version="1.0"?>
<root xmlns:reserved="reserved-ns" xmlns:special="special-ns">
<child reserved:attribute="Sample" special:attribute="Test" />
</root>
');
$spattr = $root->child->attributes('special-ns');
var_dump(Dom\import_simplexml($spattr));
?>
Resulted in this output:
object(Dom\Attr)#2 (22) {
["namespaceURI"]=>
string(10) "special-ns"
["prefix"]=>
string(7) "special"
["localName"]=>
string(9) "attribute"
["name"]=>
string(17) "special:attribute"
["value"]=>
string(4) "Test"
["ownerElement"]=>
string(22) "(object value omitted)"
["specified"]=>
bool(true)
["nodeName"]=>
string(17) "special:attribute"
["nodeValue"]=>
string(4) "Test"
["nodeType"]=>
int(2)
["parentNode"]=>
string(22) "(object value omitted)"
["parentElement"]=>
string(22) "(object value omitted)"
["childNodes"]=>
string(22) "(object value omitted)"
["firstChild"]=>
string(22) "(object value omitted)"
["lastChild"]=>
string(22) "(object value omitted)"
["previousSibling"]=>
string(22) "(object value omitted)"
["nextSibling"]=>
NULL
["attributes"]=>
NULL
["isConnected"]=>
bool(true)
["ownerDocument"]=>
string(22) "(object value omitted)"
["baseURI"]=>
string(11) "about:blank"
["textContent"]=>
string(4) "Test"
}
But I expected this output instead:
Fatal error: Dom\import_simplexml(): Return value must be of type Dom\Element, Dom\Attr returned in Unknown on line 0
To reproduce:
-d "zend_extension=/php-src/modules/opcache.so" -d "opcache.enable=1" -d "opcache.enable_cli=1" -d "opcache.jit=1215"
PHP Version
nightly
Operating System
ubuntu 22.04