Skip to content

AOT: DOMXPath //@* NodeList::item(N>0) host-fold materialization (#32003) - #35706

Merged
PurHur merged 1 commit into
masterfrom
fix/dom-xpath-attr-star-item-n-aot-32003
Aug 29, 2026
Merged

AOT: DOMXPath //@* NodeList::item(N>0) host-fold materialization (#32003)#35706
PurHur merged 1 commit into
masterfrom
fix/dom-xpath-attr-star-item-n-aot-32003

Conversation

@PurHur

@PurHur PurHur commented Aug 29, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix AOT segfault when DOMNodeList::item(N) is called with N > 0 on host-folded XPath attribute-axis node-sets (//@*, //a/@*, //attribute::*, etc.).
  • Root cause: compile-time folding only cached item(0) via DomUserScriptElementCacheLlvm; further indices fell through to DomNodeListItemRuntime and crashed.
  • Materialize item(N) from the host Zend node-set at compile time (JitDomXPathQueryUserScript::hostXPathAxisNodeAt + JitDomNodeListItemUserScript::materializeNthXPathAxisMatch).
  • Extend dom_xpath_attr_star.phpt to assert star1 / star2 node names.

php-src reference: ext/dom/xpath.c — attribute axis node-set in document order.

Verification

./script/aot-smoke.sh
# aot-smoke: 8 passed, 0 failed

./script/phpunit.sh --filter DomXpathAttrStarAotTest
# OK (1 test, 5 assertions)

./script/docker-exec.sh -- bash -lc 'php bin/compile.php -o /tmp/x.bin test/repro/aot_dom_xpath_attr_star_32003.php && /tmp/x.bin'
# star=3 / star0=id / a_star=2 / axis=3 / named=1

Not covered

  • Held NodeLists iterated inside a helper when the translation unit contains many distinct XPath queries still share one compile-time axis expr slot (test/repro/maintainer_gap_dom_xpath_attr_star.php); per-list snapshot follow-up needed.
  • ./script/release-readiness.sh not run (Pillar 1 probe owned separately).

Closes #32003

Made with Cursor

).

Compile-time attribute-axis queries only cached item(0); item(1+) fell through
to DomNodeListItemRuntime and segfaulted. Materialize further indices from the
host Zend node-set and extend the AOT fixture to cover star1/star2.

php-src: ext/dom/xpath.c attribute axis node-set iteration.
Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit bc118a4 into master Aug 29, 2026
1 check failed
@PurHur
PurHur deleted the fix/dom-xpath-attr-star-item-n-aot-32003 branch August 29, 2026 08:23
PurHur added a commit that referenced this pull request Aug 29, 2026
…5730)

Recent DOM AOT landings (#35706#35726) invalidated committed helper-unit
fingerprints; cold builds were re-emitting locally. Targeted per-unit emit +
publish restores 441/441 fresh without a full corpus sweep.

Co-authored-by: PurHur <PurHur@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression: DOMXPath //@* and attribute::* return empty — Zend returns Attr nodes (ext/dom/xpath.c)

1 participant