mirror of
https://github.com/php/php-src.git
synced 2024-12-18 14:30:35 +08:00
2f1f34952e
I'm removing the argument entirely here, but we might want to change this to passing null or and empty array instead, if the impact of dropping it entirely turns out to be too large. This was deprecated as part of https://wiki.php.net/rfc/deprecations_php_7_2 as a doc-only deprecation.
47 lines
990 B
PHP
47 lines
990 B
PHP
--TEST--
|
|
Bug #45805 (Crash on throwing exception from error handler)
|
|
--FILE--
|
|
<?php
|
|
class PHPUnit_Util_ErrorHandler
|
|
{
|
|
public static function handleError($errno, $errstr, $errfile, $errline)
|
|
{
|
|
throw new RuntimeException;
|
|
}
|
|
}
|
|
|
|
class A {
|
|
public function getX() {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
class B {
|
|
public function foo() {
|
|
$obj = new A;
|
|
$source = &$obj->getX();
|
|
}
|
|
|
|
public function bar() {
|
|
$m = new ReflectionMethod('B', 'foo');
|
|
$m->invoke($this);
|
|
}
|
|
}
|
|
|
|
set_error_handler(
|
|
array('PHPUnit_Util_ErrorHandler', 'handleError'), E_ALL
|
|
);
|
|
|
|
$o = new B;
|
|
$o->bar();
|
|
?>
|
|
--EXPECTF--
|
|
Fatal error: Uncaught RuntimeException in %sbug45805.php:%d
|
|
Stack trace:
|
|
#0 %sbug45805.php(%d): PHPUnit_Util_ErrorHandler::handleError(8, 'Only variables ...', '%s', %d)
|
|
#1 [internal function]: B->foo()
|
|
#2 %sbug45805.php(%d): ReflectionMethod->invoke(Object(B))
|
|
#3 %sbug45805.php(%d): B->bar()
|
|
#4 {main}
|
|
thrown in %sbug45805.php on line %d
|