-
Notifications
You must be signed in to change notification settings - Fork 7.9k
internal iterator rewind handler is called twice #12060
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
Labels
Comments
ju1ius
added a commit
to ju1ius/php-src
that referenced
this issue
Aug 27, 2023
ju1ius
added a commit
to ju1ius/php-src
that referenced
this issue
Aug 27, 2023
ju1ius
added a commit
to ju1ius/php-src
that referenced
this issue
Aug 27, 2023
ju1ius
added a commit
to ju1ius/php-src
that referenced
this issue
Aug 27, 2023
ju1ius
added a commit
to ju1ius/php-src
that referenced
this issue
Aug 27, 2023
ju1ius
added a commit
to ju1ius/php-src
that referenced
this issue
Aug 27, 2023
ju1ius
added a commit
to ju1ius/php-src
that referenced
this issue
Sep 2, 2023
ju1ius
added a commit
to ju1ius/php-src
that referenced
this issue
Sep 2, 2023
ju1ius
added a commit
to ju1ius/php-src
that referenced
this issue
Sep 5, 2023
ju1ius
added a commit
to ju1ius/php-src
that referenced
this issue
Sep 5, 2023
ju1ius
added a commit
to ju1ius/php-src
that referenced
this issue
Sep 5, 2023
ju1ius
added a commit
to ju1ius/php-src
that referenced
this issue
Sep 5, 2023
Girgias
pushed a commit
that referenced
this issue
Sep 5, 2023
Signed-off-by: George Peter Banyard <girgias@php.net>
Girgias
added a commit
that referenced
this issue
Sep 5, 2023
* PHP-8.1: Prevents double call to internal iterator rewind handler adds failing test case for #12060
Girgias
added a commit
that referenced
this issue
Sep 5, 2023
* PHP-8.2: Prevents double call to internal iterator rewind handler adds failing test case for #12060
Girgias
added a commit
that referenced
this issue
Sep 5, 2023
* PHP-8.3: Prevents double call to internal iterator rewind handler adds failing test case for #12060
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
Hi,
The
InternalIterator
class (inzend_interfaces.c
) uses an internalrewind_called
flag to ensure that internal iterators are always rewound. This flag is checked by thezend_internal_iterator_ensure_rewound
function, in the following methods:InternalIterator::current()
InternalIterator::key()
InternalIterator::next()
InternalIterator::valid()
However, in the
InternalIterator::rewind()
method, therewind_called
flag is not properly set when the iterator has a rewind handler. As a result, the internal iterator's rewind handler is always called twice on first iteration.This is problematic since internal iterators can perform potentially heavy initialization logic in the
rewind
handler (like performing a query in the case of a database result-set iterator).PHP Version
PHP 8.3-dev
Operating System
irrelevant
The text was updated successfully, but these errors were encountered: