1--TEST-- 2Bug #45805 (Crash on throwing exception from error handler) 3--SKIPIF-- 4<?php extension_loaded('reflection') or die('skip'); ?> 5--FILE-- 6<?php 7class PHPUnit_Util_ErrorHandler 8{ 9 public static function handleError($errno, $errstr, $errfile, $errline) 10 { 11 throw new RuntimeException; 12 } 13} 14 15class A { 16 public function getX() { 17 return NULL; 18 } 19} 20 21class B { 22 public function foo() { 23 $obj = new A; 24 $source = &$obj->getX(); 25 } 26 27 public function bar() { 28 $m = new ReflectionMethod('B', 'foo'); 29 $m->invoke($this); 30 } 31} 32 33set_error_handler( 34 array('PHPUnit_Util_ErrorHandler', 'handleError'), E_ALL | E_STRICT 35); 36 37$o = new B; 38$o->bar(); 39?> 40--EXPECTF-- 41Fatal error: Uncaught exception 'RuntimeException' in %sbug45805.php:%d 42Stack trace: 43#0 %sbug45805.php(%d): PHPUnit_Util_ErrorHandler::handleError(2048, 'Only variables ...', '%s', %d, Array) 44#1 [internal function]: B->foo() 45#2 %sbug45805.php(%d): ReflectionMethod->invoke(Object(B)) 46#3 %sbug45805.php(%d): B->bar() 47#4 {main} 48 thrown in %sbug45805.php on line %d 49