Fix destruction of generator running in fibers during shutdown (#15158) The destructor of generators is a no-op when the generator is running in a fiber, because the fiber may resume the
Fix destruction of generator running in fibers during shutdown (#15158) The destructor of generators is a no-op when the generator is running in a fiber, because the fiber may resume the generator. Normally the destructor is not called in this case, but this can happen during shutdown. We detect that a generator is running in a fiber with the ZEND_GENERATOR_IN_FIBER flag. This change fixes two cases not handled by this mechanism: - The ZEND_GENERATOR_IN_FIBER flag was not added when resuming a "yield from $nonGenerator" - When a generator that is running in a fiber has multiple children (aka multiple generators yielding from it), all of them could be considered to also run in a fiber (only one actually is), and could leak if not destroyed before shutdown.
show more ...
|