Skip to content

ext/dom: getElementsByClassName() item() returns wrong element on ran…#22701

Closed
devnexen wants to merge 1 commit into
php:PHP-8.5from
devnexen:dom_getelementsbyclassname_fix
Closed

ext/dom: getElementsByClassName() item() returns wrong element on ran…#22701
devnexen wants to merge 1 commit into
php:PHP-8.5from
devnexen:dom_getelementsbyclassname_fix

Conversation

@devnexen

Copy link
Copy Markdown
Member

…dom access.

The loop never advanced past the current match, so a cold item($n) with $n >= 1, or a backwards seek, returned the first match. Fixed by mirroring dom_map_get_elements_item(): advance to the next match once per remaining index.

…dom access.

The loop never advanced past the current match, so a cold item($n) with
$n >= 1, or a backwards seek, returned the first match. Fixed by mirroring
dom_map_get_elements_item(): advance to the next match once per remaining index.
@devnexen devnexen marked this pull request as ready for review July 11, 2026 21:24
@devnexen devnexen closed this in 7f97b83 Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants