1--TEST--
2Exceptions throwing by generators during foreach iteration are properly handled
3--FILE--
4<?php
5
6function gen() {
7    throw new Exception("foo");
8    yield; // force generator
9}
10
11foreach (gen() as $value) { }
12
13?>
14--EXPECTF--
15Fatal error: Uncaught exception 'Exception' with message 'foo' in %s:%d
16Stack trace:
17#0 %s(%d): gen()
18#1 {main}
19  thrown in %s on line %d
20
21