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