1--TEST-- 2Observer: Generator with uncaught exception 3--EXTENSIONS-- 4zend_test 5--INI-- 6zend_test.observer.enabled=1 7zend_test.observer.show_output=1 8zend_test.observer.observe_all=1 9zend_test.observer.show_return_value=1 10--FILE-- 11<?php 12function fooResults() { 13 yield 0; 14 yield 1; 15 throw new RuntimeException('Oops!'); 16} 17 18function doSomething() { 19 $generator = fooResults(); 20 foreach ($generator as $value) { 21 echo $value . PHP_EOL; 22 } 23 24 return 'You should not see this'; 25} 26 27echo doSomething() . PHP_EOL; 28?> 29--EXPECTF-- 30<!-- init '%s%eobserver_generator_%d.php' --> 31<file '%s%eobserver_generator_%d.php'> 32 <!-- init doSomething() --> 33 <doSomething> 34 <!-- init fooResults() --> 35 <fooResults> 36 </fooResults:0> 370 38 <fooResults> 39 </fooResults:1> 401 41 <fooResults> 42 <!-- Exception: RuntimeException --> 43 </fooResults:NULL> 44 <!-- Exception: RuntimeException --> 45 </doSomething:NULL> 46 <!-- Exception: RuntimeException --> 47</file '%s%eobserver_generator_%d.php'> 48 49Fatal error: Uncaught RuntimeException: Oops! in %s%eobserver_generator_%d.php:%d 50Stack trace: 51#0 %s%eobserver_generator_%d.php(%d): fooResults() 52#1 %s%eobserver_generator_%d.php(%d): doSomething() 53#2 {main} 54 thrown in %s%eobserver_generator_%d.php on line %d 55