Category
stdlib
Problem
XML/HTML processing via DOMDocument / DOMElement (ext/dom) is missing (class_exists('DOMDocument') → false). Feeds, config parsers, RSS readers, and PHPUnit-style tools expect the DOM OOP API — not only string helpers like strip_tags().
Verified Jun 2026:
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php -r "var_export(class_exists(\"DOMDocument\"));"
php -r "var_export(class_exists(\"DOMDocument\"));"
'
# VM: false · Zend (dom ext): true
php-src reference
Repro (failure today)
<?php
$doc = new DOMDocument();
$doc->loadXML('<root><item id="1">a</item></root>');
$item = $doc->getElementsByTagName('item')->item(0);
echo $item->getAttribute('id'), $item->textContent, "\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php repro_dom_load_xml.php
php bin/vm.php repro_dom_load_xml.php 2>&1 | head -3
'
| Runtime |
Output |
| Zend (ext/dom) |
1a |
bin/vm.php |
Class "DOMDocument" not found |
Scope (this repo)
| Layer |
Path |
Notes |
| Module |
ext/dom/Module.php (new) |
Register DOMDocument, DOMElement, DOMNode, DOMNodeList, DOMException |
| VM v1 |
ext/dom/VmDom.php |
libxml2 via thin FFI/trampoline (Docker image libxml2) — no large C DOM logic in runtime/ |
| Methods v1 |
loadXML, saveXML, createElement, getElementsByTagName, item, getAttribute, textContent, appendChild |
|
| Phase 2 |
loadHTML, XPath, DOMDocumentFragment (#6317) |
separate issues OK |
| Tests |
test/compliance/cases/stdlib/dom_document_load_xml.phpt |
@requires extension dom on Zend leg |
| Matrix |
script/capability-matrix.php |
VM yes; JIT/AOT defer |
PHP-in-PHP: DOM tree semantics in ext/dom/ PHP classes; C limited to libxml2 call trampoline if PHP cannot link libxml2 directly.
Done when
Verification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter dom_document_load_xml'
Related
Category
stdlibProblem
XML/HTML processing via
DOMDocument/DOMElement(ext/dom) is missing (class_exists('DOMDocument')→ false). Feeds, config parsers, RSS readers, and PHPUnit-style tools expect the DOM OOP API — not only string helpers likestrip_tags().Verified Jun 2026:
php-src reference
ext/dom/php_dom.c—dom_document_class_entry, class registrationext/dom/document.c—loadXML,loadHTML,saveXML,createElementext/dom/node.c—appendChild,getElementsByTagName, attributesext/dom/domexception.c—DOMExceptionRepro (failure today)
1abin/vm.phpClass "DOMDocument" not foundScope (this repo)
ext/dom/Module.php(new)DOMDocument,DOMElement,DOMNode,DOMNodeList,DOMExceptionext/dom/VmDom.phpruntime/loadXML,saveXML,createElement,getElementsByTagName,item,getAttribute,textContent,appendChildloadHTML, XPath,DOMDocumentFragment(#6317)test/compliance/cases/stdlib/dom_document_load_xml.phpt@requires extension domon Zend legscript/capability-matrix.phpPHP-in-PHP: DOM tree semantics in
ext/dom/PHP classes; C limited to libxml2 call trampoline if PHP cannot link libxml2 directly.Done when
1aon VM in Docker (php-compiler:22.04-devwith libxml2)DOMException— document choice in PHPT)class_exists('DOMDocument')true;instanceof DOMNodeworks for elements./script/ci-fast.sh --filter dom_document_load_xmlgreenVerification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter dom_document_load_xml'Related