1--TEST--
2Generator::throw() where the generator throws a different exception
3--FILE--
4<?php
5
6function gen() {
7    echo "before yield\n";
8    try {
9        yield;
10    } catch (RuntimeException $e) {
11        echo 'Caught: ', $e, "\n\n";
12
13        throw new LogicException('new throw');
14    }
15}
16
17$gen = gen();
18var_dump($gen->throw(new RuntimeException('throw')));
19
20?>
21--EXPECTF--
22before yield
23Caught: exception 'RuntimeException' with message 'throw' in %s:%d
24Stack trace:
25#0 {main}
26
27
28Fatal error: Uncaught exception 'LogicException' with message 'new throw' in %s:%d
29Stack trace:
30#0 [internal function]: gen()
31#1 %s(%d): Generator->throw(Object(RuntimeException))
32#2 {main}
33  thrown in %s on line %d
34
35