[php-src] PR #19327: Prevent throwing in running generator
| From: | arnaud-lb | Date: | Thu, 31 Jul 2025 08:47:57 +0000 |
| Subject: | [php-src] PR #19327: Prevent throwing in running generator | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-32725@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/19327
Author: arnaud-lb
Throwing in a running generator is not allowed. It throws "Cannot resume an already running
generator" when trying to resume the generator to handle the provided exception.
However, when calling
Generator::throw() on a generator with a delegate, we release the
delegate regardless. If a Fiber was suspended in that generator, this causes use after frees when
the Fiber is resumed.
Fix this by throwing "Cannot resume an already running generator" earlier.