1--TEST--
2Multiple yield from on a same Generator throwing an Exception
3--FILE--
4<?php
5function from() {
6    yield 1;
7    throw new Exception();
8}
9
10function gen($gen) {
11    try {
12        var_dump(yield from $gen);
13    } catch (Exception $e) { print "Caught exception!\n$e\n"; }
14}
15
16$gen = from();
17$gens[] = gen($gen);
18$gens[] = gen($gen);
19
20foreach ($gens as $g) {
21    $g->current(); // init.
22}
23
24do {
25    foreach ($gens as $i => $g) {
26        print "Generator $i\n";
27        var_dump($g->current());
28        $g->next();
29    }
30} while($gens[0]->valid());
31?>
32--EXPECTF--
33Generator 0
34int(1)
35Caught exception!
36Exception in %s:%d
37Stack trace:
38#0 %s(%d): from()
39#1 [internal function]: gen(Object(Generator))
40#2 %s(%d): Generator->next()
41#3 {main}
42Generator 1
43Caught exception!
44ClosedGeneratorException: Generator yielded from aborted, no return value available in %s:%d
45Stack trace:
46#0 [internal function]: gen(Object(Generator))
47#1 %s(%d): Generator->current()
48#2 {main}
49NULL
50