mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
This procedure may be called during i_free_compiled_variables(), when EG(current_execute_data) is unfortunately already reset to the parent frame. EG(opline_before_exception) does not actually belong to this frame. Furthermore, setting opline to EG(exception_op) early will miss a later zend_rethrow_exception(), which will also miss installation of the correct EG(opline_before_exception). Fixes GH-20714 Closes GH-20716
30 lines
397 B
PHP
30 lines
397 B
PHP
--TEST--
|
|
GH-20714: Uncatchable exception thrown in generator
|
|
--CREDITS--
|
|
Grégoire Paris (greg0ire)
|
|
--FILE--
|
|
<?php
|
|
|
|
function gen(): Generator {
|
|
try {
|
|
yield 1;
|
|
} finally {}
|
|
}
|
|
|
|
function process(): void {
|
|
$g = gen();
|
|
foreach ($g as $_) {
|
|
throw new Exception('ERROR');
|
|
}
|
|
}
|
|
|
|
try {
|
|
process();
|
|
} catch (Exception $e) {
|
|
echo "Caught\n";
|
|
}
|
|
|
|
?>
|
|
--EXPECT--
|
|
Caught
|