Skip to content

Fix handling of invalid iterator in zend_weakmap_iterator_get_current_get() #16436

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

arnaud-lb
Copy link
Member

Fixes GH-16371

WeakMap's implementation of zend_object_iterator_funcs.get_current_key doesn't handle invalid states.

Here I set the key to NULL in zend_weakmap_iterator_get_current_get() when there is no more elements. This matches other implementations of zend_object_iterator_funcs.get_current_key as well as the documentation of Iterator::key.

@arnaud-lb arnaud-lb changed the base branch from master to PHP-8.2 October 14, 2024 12:12
@arnaud-lb arnaud-lb marked this pull request as ready for review October 14, 2024 16:00
@arnaud-lb arnaud-lb closed this in 1d94fb8 Oct 15, 2024
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.

Assertion failure in Zend/zend_weakrefs.c:646
2 participants