php-src/Zend/tests/bug45805.phpt
Nikita Popov 1a3bdb4a2c Remove some references to E_STRICT in tests
run-tests.php enforces error_reporting=E_ALL (including E_STRICT),
setting this explicitly in not necessary. Conversely, after the
removal of some E_STRICT errors, explicitly excluding it is no
longer necessary in some places.
2018-02-03 18:17:12 +01:00

47 lines
997 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, Array)
#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