mirror of
https://github.com/php/php-src.git
synced 2026-03-30 04:02:19 +02:00
Fix bug #69740
This commit is contained in:
2
NEWS
2
NEWS
@@ -13,6 +13,8 @@ PHP NEWS
|
||||
fault). (Christoph M. Becker)
|
||||
. Fixed bug #69781 (phpinfo() reports Professional Editions of Windows
|
||||
7/8/8.1/10 as "Business"). (Christian Wenz)
|
||||
. Fixed bug #69740 (finally in generator (yield) swallows exception in
|
||||
iteration). (Nikita)
|
||||
|
||||
- PDO_pgsql:
|
||||
. Fixed bug #69752 (PDOStatement::execute() leaks memory with DML
|
||||
|
||||
28
Zend/tests/bug69740.phpt
Normal file
28
Zend/tests/bug69740.phpt
Normal file
@@ -0,0 +1,28 @@
|
||||
--TEST--
|
||||
Bug #69740: finally in generator (yield) swallows exception in iteration
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function generate() {
|
||||
try {
|
||||
yield 1;
|
||||
yield 2;
|
||||
} finally {
|
||||
echo "finally\n";
|
||||
}
|
||||
}
|
||||
|
||||
foreach (generate() as $i) {
|
||||
echo $i, "\n";
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
1
|
||||
finally
|
||||
|
||||
Fatal error: Uncaught exception 'Exception' in %s:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %s on line %d
|
||||
@@ -198,6 +198,9 @@ static void zend_generator_dtor_storage(zend_generator *generator, zend_object_h
|
||||
if (finally_op_num) {
|
||||
ex->opline = &ex->op_array->opcodes[finally_op_num];
|
||||
ex->fast_ret = NULL;
|
||||
ex->delayed_exception = EG(exception);
|
||||
EG(exception) = NULL;
|
||||
|
||||
generator->flags |= ZEND_GENERATOR_FORCED_CLOSE;
|
||||
zend_generator_resume(generator TSRMLS_CC);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user