Skip to content

AOT: Document childNodes + before/after comment match Zend (#34160) - #34164

Merged
PurHur merged 1 commit into
masterfrom
fix/34160-dom-document-childnodes-comment
Aug 23, 2026
Merged

AOT: Document childNodes + before/after comment match Zend (#34160)#34164
PurHur merged 1 commit into
masterfrom
fix/34160-dom-document-childnodes-comment

Conversation

@PurHur

@PurHur PurHur commented Aug 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix thin-AOT DOMDocument::$childNodes to read/write DOMDocument layout (was always Element), so LiveSlots after ChildNode::before/after / insertBefore are visible.
  • Seed loadXML Document firstChild/lastChild/childNodes with the root; walk Document children in document-wide saveXML (php-src xmlDocDumpMemory).
  • Owner-aware DOMNodeList::item() uses Document-aware firstChild; skip UserScript item(0) pinned-root shortcut after tree mutations.

Closes #34160

php-src

  • ext/dom/php_dom.cdom_child_node_before / dom_add_prev_sibling
  • ext/dom/document.csaveXMLxmlDocDumpMemory

Test plan

Verify transcript

aot-smoke: 8 passed, 0 failed

PHPUnit … OK (2 tests, 6 assertions)

AOT issue_34160:
<?xml version="1.0"?>
<!--x-->
<r/>
len=2
item0=#comment
item1=r
…
len3=2

Made with Cursor

Document::$childNodes was fetched from DOMElement layout so LiveSlots writes
were invisible; document-wide saveXML only dumped documentElement. Seed
loadXML firstChild and walk Document children for xmlDocDumpMemory parity.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit e1c4d07 into master Aug 23, 2026
@PurHur
PurHur deleted the fix/34160-dom-document-childnodes-comment branch August 23, 2026 07:02
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.

AOT: Document ChildNode::before/after + insertBefore comment drops sibling / childNodes length 0 (ext/dom/php_dom.c)

1 participant