Skip to content

Commit

Permalink
Prevents double call to internal iterator rewind handler
Browse files Browse the repository at this point in the history
Closes GH-12060

Signed-off-by: George Peter Banyard <girgias@php.net>
  • Loading branch information
ju1ius authored and Girgias committed Sep 5, 2023
1 parent 9658d9a commit da7a66d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions NEWS
Expand Up @@ -8,6 +8,8 @@ PHP NEWS
(Jeremie Courreges-Anglas)
. Fixed bug GH-12073 (Segfault when freeing incompletely initialized
closures). (ilutov)
. Fixed bug GH-12060 (Internal iterator rewind handler is called twice).
(ju1ius)

- DOM:
. Fix memory leak when setting an invalid DOMDocument encoding. (nielsdos)
Expand Down
1 change: 1 addition & 0 deletions Zend/zend_interfaces.c
Expand Up @@ -585,6 +585,7 @@ ZEND_METHOD(InternalIterator, rewind) {
RETURN_THROWS();
}

intern->rewind_called = 1;
if (!intern->iter->funcs->rewind) {
/* Allow calling rewind() if no iteration has happened yet,
* even if the iterator does not support rewinding. */
Expand Down

0 comments on commit da7a66d

Please sign in to comment.