Drop support for multiple generators yielding from one generator #6071
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This drops support for having multiple generators
yield from
the same generator in parallel. Support for this requires the famous "doubly-linked refcounted generator tree" that is very hard to understand and serves a non-existent use-case.A new use-after-free in this area has recently surfaced (oss-fuzz #25344), as triggered by the test case Zend/tests/generators/yield_from_multi_child_destroyed.phpt. I tried to find a fix, but it's really not simple. The code didn't really consider the possibility of a "child" generator (the one calling yield from) being destroyed before the "parent" generator (the one being yielded from) and the parent generator being used afterwards.
This PR only adds an exception. I would clean up the implementation in a separate commit.