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' --> 31<file '%s'> 32 <!-- init doSomething() --> 33 <doSomething> 34 <!-- init fooResults() --> 35 <fooResults> 36 </fooResults:0> 370 38 <fooResults> 39 </fooResults:1> 401 41 <fooResults> 42 <!-- init Exception::__construct() --> 43 <Exception::__construct> 44 </Exception::__construct:NULL> 45 <!-- Exception: RuntimeException --> 46 </fooResults:NULL> 47 <!-- Exception: RuntimeException --> 48 </doSomething:NULL> 49 <!-- Exception: RuntimeException --> 50</file '%s'> 51<!-- init Exception::__toString() --> 52<Exception::__toString> 53 <!-- init Exception::getTraceAsString() --> 54 <Exception::getTraceAsString> 55 </Exception::getTraceAsString:'#0 %s(%d): fooResults() 56#1 %s(%d): doSomething() 57#2 {main}'> 58</Exception::__toString:'RuntimeException: Oops! in %s%eobserver_generator_%d.php:%d 59Stack trace: 60#0 %s%eobserver_generator_%d.php(%d): fooResults() 61#1 %s%eobserver_generator_%d.php(%d): doSomething() 62#2 {main}'> 63 64Fatal error: Uncaught RuntimeException: Oops! in %s%eobserver_generator_%d.php:%d 65Stack trace: 66#0 %s%eobserver_generator_%d.php(%d): fooResults() 67#1 %s%eobserver_generator_%d.php(%d): doSomething() 68#2 {main} 69 thrown in %s%eobserver_generator_%d.php on line %d 70