1--TEST--
2Stack is cleaned up properly when an exception is thrown during a function call
3--FILE--
4<?php
5
6function throwException() {
7    throw new Exception('test');
8}
9
10function gen() {
11    yield 'foo';
12    strlen("foo", "bar", throwException());
13    yield 'bar';
14}
15
16$gen = gen();
17
18var_dump($gen->current());
19
20try {
21    $gen->next();
22} catch (Exception $e) {
23    echo 'Caught exception with message "', $e->getMessage(), '"', "\n";
24}
25
26var_dump($gen->current());
27
28?>
29--EXPECT--
30string(3) "foo"
31Caught exception with message "test"
32NULL
33