1--TEST--
2Generators can throw exceptions
3--FILE--
4<?php
5
6function gen() {
7    yield 'foo';
8    throw new Exception('test');
9    yield 'bar';
10}
11
12$gen = gen();
13
14var_dump($gen->current());
15
16try {
17    $gen->next();
18} catch (Exception $e) {
19    echo 'Caught exception with message "', $e->getMessage(), '"', "\n";
20}
21
22var_dump($gen->current());
23
24?>
25--EXPECT--
26string(3) "foo"
27Caught exception with message "test"
28NULL
29