Skip to content

DOM: ID map on detach + setIdAttribute first-wins (#25274, #25275) - #25341

Merged
PurHur merged 1 commit into
masterfrom
agent/ext-dom-25274-replacechild-same-id
Jul 30, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/ext-dom-25274-replacechild-same-id

Conversation

@PurHur

@PurHur PurHur commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Summary

php-src reference: ext/dom/document.c getElementById + ext/dom/element.c php_set_attribute_id → xmlAddID/xmlRemoveID.

Test plan

  • Zend vs VM repros:
    ./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
    php test/repro/maintainer_gap_dom_getelementbyid_replacechild_same_id.php
    php bin/vm.php test/repro/maintainer_gap_dom_getelementbyid_replacechild_same_id.php
    php test/repro/maintainer_gap_dom_getelementbyid_duplicate_setidattribute.php
    php bin/vm.php test/repro/maintainer_gap_dom_getelementbyid_duplicate_setidattribute.php'
    Output (both): null / c and a
  • JIT: same repros via php bin/jit.php — match
  • vendor/bin/phpunit --filter 'dom_getelementbyid|dom_setidattribute|…' — 26 OK
  • Related Regression: DOMDocument::getElementById() after setIdAttribute on detached node + replaceChild — Zend null, VM finds node (ext/dom/node.c) #23999 detached replaceChild still green
  • AOT user-script setIdAttribute still unbound (Call to undefined method object::setidattribute()) — pre-existing; not in this change’s scope

Made with Cursor

Match libxml/php-src 8.2: IDs stay registered after removeChild/replaceChild
until the attr is destroyed, and duplicate setIdAttribute does not overwrite.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit d0c4e40 into master Jul 30, 2026
1 check failed
@PurHur
PurHur deleted the agent/ext-dom-25274-replacechild-same-id branch July 30, 2026 10:53
PurHur added a commit that referenced this pull request Jul 30, 2026
Re-emit DateTime/timezone, DOM, and Preg helper TUs after #25340/#25341/#25342
so check-helper-runtime-prelink --strict and release-readiness stay green.

Closes #25347

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: DOMDocument::getElementById() null after replaceChild same id + setIdAttribute — Zend null, VM finds node (re-#23999, ext/dom/node.c)

1 participant