[GIT-PULLS] [php-src] PR #23270: Fix GH-11591: AppendIterator with generators that yield nothing
[email protected] (matthiasgoergens)
| Newsgroups | php.git-pulls |
|---|---|
| Message-ID | <yWAPkfuA5QaT5HaMkNie5eL0kF5MkrwgsSC57lccmV4@main.internal.php.net> |
Pull Request: https://github.com/php/php-src/pull/23270 Author: matthiasgoergens Appending a generator probes it by rewinding, which runs an empty generator to completion; traversing it later then throws "Cannot traverse an already closed generator". Mark generators exhausted by this probe and skip them during traversal, including after the inner array is modified. A deliberate behaviour change: appending the same probed-empty generator twice now adds two empty entries instead of throwing on the second append; consumed (once-yielded) generators still throw on re-traversal.