1--TEST--
2Exceptions in linear yield from setup
3--FILE--
4<?php
5function from($off) {
6	try {
7		yield $off + 1;
8	} catch (Exception $e) { print "catch in from()\n$e\n"; }
9	yield $off + 2;
10}
11
12function gen() {
13	try {
14		yield "gen" => 0;
15	} catch (Exception $e) { print "catch in gen()\n$e\n"; }
16	try {
17		yield from from(0);
18	} catch (Exception $e) { print "catch in gen()\n$e\n"; }
19	yield from from(2);
20}
21
22$i = 0;
23try {
24	for ($gen = gen(); $gen->valid(); $gen->throw(new Exception((string) $i++))) {
25		var_dump($gen->current());
26	}
27} catch (Exception $e) { print "catch in {main}\n$e\n"; }
28
29var_dump($gen->valid());
30
31?>
32--EXPECTF--
33int(0)
34catch in gen()
35Exception: 0 in %s:%d
36Stack trace:
37#0 {main}
38int(1)
39catch in from()
40Exception: 1 in %s:%d
41Stack trace:
42#0 {main}
43int(2)
44catch in gen()
45Exception: 2 in %s:%d
46Stack trace:
47#0 {main}
48int(3)
49catch in from()
50Exception: 3 in %s:%d
51Stack trace:
52#0 {main}
53int(4)
54catch in {main}
55Exception: 4 in %s:%d
56Stack trace:
57#0 {main}
58bool(false)
59