mirror of
https://github.com/php/php-src.git
synced 2024-10-01 06:46:08 +00:00
25 lines
409 B
Plaintext
25 lines
409 B
Plaintext
|
--TEST--
|
||
|
try { yield } finally { throw }
|
||
|
--FILE--
|
||
|
<?php
|
||
|
function foo($f, $t) {
|
||
|
for ($i = $f; $i <= $t; $i++) {
|
||
|
try {
|
||
|
yield $i;
|
||
|
} finally {
|
||
|
throw new Exception;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
foreach (foo(1, 5) as $x) {
|
||
|
echo $x, "\n";
|
||
|
}
|
||
|
--EXPECTF--
|
||
|
1
|
||
|
|
||
|
Fatal error: Uncaught exception 'Exception' in %s:%d
|
||
|
Stack trace:
|
||
|
#0 %s(%d): foo(1, 5)
|
||
|
#1 {main}
|
||
|
thrown in %s on line %d
|