Skip to content

DOM: appendChild(DOMDocument) raises Hierarchy Request Error (#22698)#22800

Merged
PurHur merged 2 commits into
masterfrom
agent/issue-22698-appendchild-hierarchy-request
Jul 24, 2026
Merged

DOM: appendChild(DOMDocument) raises Hierarchy Request Error (#22698)#22800
PurHur merged 2 commits into
masterfrom
agent/issue-22698-appendchild-hierarchy-request

Conversation

@PurHur

@PurHur PurHur commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #22698

php-src reference

  • ext/dom/node.cdom_node_append_child hierarchy check
  • ext/dom/php_dom.cHIERARCHY_REQUEST_ERR

PHP implementation

  • ext/dom/ElementAppendChild.php, NodeAppendChild.php, DocumentAppendChild.php, FragmentAppendChild.php
  • ext/dom/VmDom.php, ext/dom/DomExceptionConstants.php

Test plan

  • php bin/vm.php test/repro/issue_22698_appendchild_document_hierarchy.php
  • php bin/jit.php test/repro/issue_22698_appendchild_document_hierarchy.php
  • ./script/phpunit.sh --filter dom_appendchild_document_hierarchy (VM+JIT green)
  • php script/bootstrap-inventory.php --check → OK 6508/6508

Trust preflight (host)

Note

dom_node_appendchild_ancestor_hierarchy (#19753) currently shows empty insertBefore/replaceChild exception payloads on this host for both master and this branch (pre-existing); out of scope for #22698.

Made with Cursor

PurHur and others added 2 commits July 24, 2026 06:04
Accept DOMDocument as a typed DOMNode argument, then reject with
DOMException message/code 3 (php-src ext/dom/node.c) instead of TypeError.

Co-authored-by: Cursor <cursoragent@cursor.com>
Regenerate docs/bootstrap-inventory.md after taking master for the conflicted generated file.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit a4a5727 into master Jul 24, 2026
1 check failed
@PurHur
PurHur deleted the agent/issue-22698-appendchild-hierarchy-request branch July 24, 2026 06:07
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: DOMElement::appendChild(DOMDocument) TypeError — Zend DOMException Hierarchy Request Error (ext/dom/node.c)

1 participant