Category
stdlib
Problem
DOMDocument / DOMElement tree APIs are tracked in #3326, but XPath evaluation via DOMXPath is a separate php-src surface. Code using $xpath = new DOMXPath($doc); $xpath->query('//item') fails here because class_exists('DOMXPath', false) is false (verified 2026-06-05).
php-src reference
Repro (failure today)
Save as test/repro-maintainer/parity_domxpath.php:
<?php
$xml = '<root><item id="1">a</item><item id="2">b</item></root>';
$doc = new DOMDocument();
$doc->loadXML($xml);
var_export(class_exists('DOMXPath', false));
echo "\n";
$xpath = new DOMXPath($doc);
$nodes = $xpath->query('//item[@id="2"]');
echo $nodes->length, "\n";
echo $nodes->item(0)->textContent, "\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php test/repro-maintainer/parity_domxpath.php
php bin/vm.php test/repro-maintainer/parity_domxpath.php
'
| Runtime |
Expected |
Actual (2026-06-05) |
| Zend PHP |
true, 1, b |
— |
| bin/vm.php |
same |
fails earlier if DOMDocument missing (#3326); otherwise DOMXPath not found |
Note: If #3326 is not landed, repro may fail on DOMDocument first — implement XPath after minimal DOM tree exists, or stub DOM in repro for isolated XPath unit tests.
Scope (PHP-in-PHP first)
| Path |
Work |
ext/dom/ (with #3326) |
DOMXPath class + query() / evaluate() VM builtins |
lib/VM/BuiltinClasses.php |
register DOMXPath |
| libxml2 |
thin C ABI for xpath context if no PHP binding exists |
| Tests |
test/compliance/cases/stdlib/dom_xpath_query.phpt |
Depends on #3326 for DOMDocument / DOMNodeList objects.
Done when
Verification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter dom_xpath'
Links
Category
stdlibProblem
DOMDocument/DOMElementtree APIs are tracked in #3326, but XPath evaluation viaDOMXPathis a separate php-src surface. Code using$xpath = new DOMXPath($doc); $xpath->query('//item')fails here becauseclass_exists('DOMXPath', false)is false (verified 2026-06-05).php-src reference
ext/dom/xpath.c—DOMXPathclass,query,evaluate,registerNamespaceext/dom/dom_ce.h— DOM class registryext/dom/php_dom.stub.php—DOMXPathstubsRepro (failure today)
Save as
test/repro-maintainer/parity_domxpath.php:true,1,bDOMDocumentmissing (#3326); otherwiseDOMXPathnot foundNote: If #3326 is not landed, repro may fail on
DOMDocumentfirst — implement XPath after minimal DOM tree exists, or stub DOM in repro for isolated XPath unit tests.Scope (PHP-in-PHP first)
ext/dom/(with #3326)DOMXPathclass +query()/evaluate()VM builtinslib/VM/BuiltinClasses.phpDOMXPathtest/compliance/cases/stdlib/dom_xpath_query.phptDepends on #3326 for
DOMDocument/DOMNodeListobjects.Done when
true,1,bon VM (with DOM tree from Stdlib: ext/dom — DOMDocument/DOMElement XML tree API (ext/dom parity) #3326 or minimal fixture)DOMXPath::query()returnsDOMNodeListwith correct length and node textregisterNamespace()prefix binding works for namespaced documents (v1 subset OK)./script/ci-fast.sh --filter dom_xpathgreenVerification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter dom_xpath'Links