Category
stdlib · php-src-strict · ext/dom AOT bridge · pillar 4
Problem
VM and JIT match Zend for DOMElement::setIdAttribute() + getElementById(). Thin user-script AOT does not:
| Repro |
Zend 8.2+ / VM / JIT |
AOT (phpc build, 2026-08-09 @7bd8ddf2e2) |
$el = $doc->documentElement->firstChild; $el->setIdAttribute('id', true) |
works |
compile: Call to undefined method object::setidattribute() |
$el = $doc->createElement('a'); … $el->setIdAttribute('id', true) |
works |
compiles via ExternalMethod fallthrough → segfault (internal_N) |
Root cause: setIdAttribute* is implemented in VmDomInstanceInvoke / VmDomJitDispatch but is not in DomInstanceMethodJit::USER_SCRIPT_DIRECT_METHODS, so :object receivers (child props) fail at compile and typed DOMElement receivers bind the null ExternalMethod stub.
php-src reference
PHP implementation target
lib/JIT/DomInstanceMethodJit.php — add domelement::setidattribute{,ns,node} to user-script direct methods + registerKnownProxies
lib/JIT.php — :object receiver ensureProxy/bind (peer #27108 attribute path)
- Reuse
Call\DomInstanceMethod → VmDomInstanceInvoke (already dispatches setidattribute*); no new C
Repro
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
cat > /tmp/setid_aot.php <<'"'"'PHP'"'"'
<?php
$d = new DOMDocument();
$d->loadXML("<r><a id=\"x\"/><b id=\"x\"/></r>");
$a = $d->documentElement->firstChild;
$b = $a->nextSibling;
$a->setIdAttribute("id", true);
$b->setIdAttribute("id", true);
echo $d->getElementById("x")->nodeName, "\n";
PHP
php bin/vm.php /tmp/setid_aot.php
php bin/compile.php -o /tmp/setid_aot /tmp/setid_aot.php && /tmp/setid_aot'
Expect: a on VM and AOT (first-wins, #25275).
Done when
Category
stdlib· php-src-strict · ext/dom AOT bridge · pillar 4Problem
VM and JIT match Zend for
DOMElement::setIdAttribute()+getElementById(). Thin user-script AOT does not:phpc build, 2026-08-09 @7bd8ddf2e2)$el = $doc->documentElement->firstChild; $el->setIdAttribute('id', true)Call to undefined method object::setidattribute()$el = $doc->createElement('a'); … $el->setIdAttribute('id', true)internal_N)Root cause:
setIdAttribute*is implemented inVmDomInstanceInvoke/VmDomJitDispatchbut is not inDomInstanceMethodJit::USER_SCRIPT_DIRECT_METHODS, so:objectreceivers (child props) fail at compile and typedDOMElementreceivers bind the null ExternalMethod stub.php-src reference
ext/dom/element.c—dom_element_set_id_attribute*ext/dom/php_dom.stub.php—DOMElement::setIdAttributePHP implementation target
lib/JIT/DomInstanceMethodJit.php— adddomelement::setidattribute{,ns,node}to user-script direct methods +registerKnownProxieslib/JIT.php—:objectreceiver ensureProxy/bind (peer#27108attribute path)Call\DomInstanceMethod→VmDomInstanceInvoke(already dispatchessetidattribute*); no new CRepro
Expect:
aon VM and AOT (first-wins, #25275).Done when
a)runtime/C