Category
stdlib · php-src-strict · Dom living XPath · pillar 4 (DOM)
Problem
PHP 8.4 Dom\XPath is the living-standard equivalent of DOMXPath for Dom\HTMLDocument / Dom\XMLDocument. On PHP_COMPILER_PROFILE=8.4 the class is absent (Class "Dom\XPath" not found) while legacy DOMXPath already accepts living documents.
| Repro |
Zend 8.4+ (ext/dom) |
VM PROFILE=8.4 (2026-07-19) |
class_exists('Dom\\XPath') |
true |
false |
new Dom\\XPath($htmlDoc) |
Dom\XPath |
fatal Class not found |
$xp->query('//p')->item(0) on HTMLDocument |
node |
N/A |
php-src reference
PHP implementation target
- Register
Dom\XPath (+ Dom\NodeList for query/evaluate node-set returns) in ext/dom/DomLivingBuiltinClasses.php
- Living construct accepting
Dom\Document (reject legacy DOMDocument with TypeError)
- Reuse
VmDomXPath handlers; return Dom\NodeList for living XPath (keep DOMNodeList for legacy)
- PHP-in-PHP; no new
runtime/*.c
Repro
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && PHP_COMPILER_PROFILE=8.4 php bin/vm.php test/repro/maintainer_gap_dom_xpath_living.php'
Done when
Category
stdlib· php-src-strict · Dom living XPath · pillar 4 (DOM)Problem
PHP 8.4
Dom\XPathis the living-standard equivalent ofDOMXPathforDom\HTMLDocument/Dom\XMLDocument. OnPHP_COMPILER_PROFILE=8.4the class is absent (Class "Dom\XPath" not found) while legacyDOMXPathalready accepts living documents.class_exists('Dom\\XPath')truefalsenew Dom\\XPath($htmlDoc)Dom\XPath$xp->query('//p')->item(0)on HTMLDocumentphp-src reference
ext/dom/php_dom.stub.php—namespace Dom { final class XPath }(@implementation-aliasofDOMXPathfor most methods)ext/dom/xpath.c— construct / query / evaluatePHP implementation target
Dom\XPath(+Dom\NodeListfor query/evaluate node-set returns) inext/dom/DomLivingBuiltinClasses.phpDom\Document(reject legacyDOMDocumentwith TypeError)VmDomXPathhandlers; returnDom\NodeListfor living XPath (keepDOMNodeListfor legacy)runtime/*.cRepro
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && PHP_COMPILER_PROFILE=8.4 php bin/vm.php test/repro/maintainer_gap_dom_xpath_living.php'Done when
class_exists('Dom\\XPath')true on PROFILE=8.4new Dom\\XPath(Dom\\HTMLDocument|XMLDocument)works; query/evaluate/registerNamespace/quote greenDom\\NodeList(not legacyDOMNodeList).phptundertest/compliance/cases/dom/orstdlib/