mirror of
https://github.com/php/php-src.git
synced 2025-01-06 19:03:31 +08:00
Finally with return now works in generators too
This commit is contained in:
parent
68c1e1cfe9
commit
7cdf6367a5
33
Zend/tests/generators/finally_with_return.phpt
Normal file
33
Zend/tests/generators/finally_with_return.phpt
Normal file
@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Use of finally in generator with return
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function gen() {
|
||||
try {
|
||||
try {
|
||||
echo "before return\n";
|
||||
return;
|
||||
echo "after return\n";
|
||||
} finally {
|
||||
echo "before return in inner finally\n";
|
||||
return;
|
||||
echo "after return in inner finally\n";
|
||||
}
|
||||
} finally {
|
||||
echo "outer finally run\n";
|
||||
}
|
||||
|
||||
echo "code after finally\n";
|
||||
|
||||
yield; // force generator
|
||||
}
|
||||
|
||||
$gen = gen();
|
||||
$gen->rewind(); // force run
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
before return
|
||||
before return in inner finally
|
||||
outer finally run
|
Loading…
Reference in New Issue
Block a user