mirror of
https://github.com/php/php-src.git
synced 2025-01-05 18:33:56 +08:00
897d99c7a4
Finally blocks in generators may be invoked during shutdown, in which case we don't have a stack frame. Similar to what zend_call_function does, we still need to rethrow these exceptions, otherwise they will be hidden (and leak).
31 lines
565 B
PHP
31 lines
565 B
PHP
--TEST--
|
|
Generator exceptions during shutdown should not be swallowed
|
|
--FILE--
|
|
<?php
|
|
|
|
function gen() {
|
|
try {
|
|
echo "before yield\n";
|
|
yield;
|
|
echo "after yield\n";
|
|
} finally {
|
|
echo "before yield in finally\n";
|
|
yield;
|
|
echo "after yield in finally\n";
|
|
}
|
|
echo "after finally\n";
|
|
}
|
|
|
|
$gen = gen();
|
|
$gen->rewind();
|
|
|
|
?>
|
|
--EXPECTF--
|
|
before yield
|
|
before yield in finally
|
|
|
|
Fatal error: Uncaught Error: Cannot yield from finally in a force-closed generator in %s:%d
|
|
Stack trace:
|
|
#0 {main}
|
|
thrown in %s on line %d
|