Category
bug · php-src-strict · DOM NamedNodeMap
Problem
For a namespaced attribute (xmlns:x="urn:x" x:a="1"), Zend DOMNamedNodeMap::getNamedItem("a") returns the Attr (lookup by local name). getNamedItem("x:a") returns null. VM inverts this: local name misses, qualified name hits.
| Repro |
Zend 8.2 (2026-07-28) |
VM (2026-07-28) |
getNamedItem("a") on x:a="1" |
Attr nodeValue 1 |
null |
getNamedItem("x:a") |
null |
Attr nodeValue 1 |
getNamedItemNS("urn:x","a") |
1 (both) |
1 (both) |
php-src reference
PHP implementation target
ext/dom/ NamedNodeMap getNamedItem — match php-src local-name lookup for namespaced Attr nodes; do not key solely on node->name / qName string
Repro
./script/docker-exec.sh -- bash -lc 'cat > /tmp/getnameditem_ns.php <<'"'"'PHP'"'"'
<?php
$doc = new DOMDocument();
$doc->loadXML("<root xmlns:x=\"urn:x\" x:a=\"1\" b=\"2\"/>");
$m = $doc->documentElement->attributes;
echo "local=", var_export($m->getNamedItem("a")?->nodeValue, true), "\n";
echo "qname=", var_export($m->getNamedItem("x:a")?->nodeValue, true), "\n";
PHP
php /tmp/getnameditem_ns.php; php bin/vm.php /tmp/getnameditem_ns.php'
Done when
Category
bug· php-src-strict · DOM NamedNodeMapProblem
For a namespaced attribute (
xmlns:x="urn:x" x:a="1"), ZendDOMNamedNodeMap::getNamedItem("a")returns the Attr (lookup by local name).getNamedItem("x:a")returnsnull. VM inverts this: local name misses, qualified name hits.getNamedItem("a")onx:a="1"1nullgetNamedItem("x:a")null1getNamedItemNS("urn:x","a")1(both)1(both)php-src reference
ext/dom/nodemap.c—dom_namednodemap_get_named_item/ libxmlxmlHasNsProplocal-name pathgetNamedItemNSpresence); this is non-NSgetNamedItemlocal-name semanticsPHP implementation target
ext/dom/NamedNodeMapgetNamedItem— match php-src local-name lookup for namespaced Attr nodes; do not key solely onnode->name/ qName stringRepro
Done when
getNamedItem("a")returns the namespaced Attr;getNamedItem("x:a")returnsnull(VM + JIT/AOT in scope)getNamedItem/getNamedItemNSunchanged