1--TEST-- 2Observer: Basic observability of userland functions with uncaught exceptions 3--EXTENSIONS-- 4zend_test 5--INI-- 6zend_test.observer.enabled=1 7zend_test.observer.show_output=1 8zend_test.observer.observe_all=1 9--FILE-- 10<?php 11function foo() 12{ 13 static $callCount = 0; 14 echo 'Call #' . $callCount . PHP_EOL; 15 if (++$callCount == 3) { 16 throw new RuntimeException('Third time is a charm'); 17 } 18} 19 20foo(); 21foo(); 22foo(); 23 24echo 'You should not see this' . PHP_EOL; 25?> 26--EXPECTF-- 27<!-- init '%s' --> 28<file '%s'> 29 <!-- init foo() --> 30 <foo> 31Call #0 32 </foo> 33 <foo> 34Call #1 35 </foo> 36 <foo> 37Call #2 38 <!-- init Exception::__construct() --> 39 <Exception::__construct> 40 </Exception::__construct> 41 <!-- Exception: RuntimeException --> 42 </foo> 43 <!-- Exception: RuntimeException --> 44</file '%s'> 45<!-- init Exception::__toString() --> 46<Exception::__toString> 47 <!-- init Exception::getTraceAsString() --> 48 <Exception::getTraceAsString> 49 </Exception::getTraceAsString> 50</Exception::__toString> 51 52Fatal error: Uncaught RuntimeException: Third time is a charm in %s%eobserver_exception_%d.php:%d 53Stack trace: 54#0 %s%eobserver_exception_%d.php(%d): foo() 55#1 {main} 56 thrown in %s%eobserver_exception_%d.php on line %d 57