Skip to content

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

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

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
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.

1 participant