xref: /PHP-8.1/ext/reflection/tests/bug76536.phpt (revision 1a370d33)
1--TEST--
2Bug #76536 (PHP crashes with core dump when throwing exception in error handler)
3--SKIPIF--
4<?php
5if (getenv('SKIP_PRELOAD')) die('skip Error handler not available during preloading');
6?>
7--FILE--
8<?php
9class SomeConstants {const SOME_CONSTANT = "0foo" % 5; }
10
11function handleError() {throw new ErrorException();}
12
13set_error_handler('handleError');
14set_exception_handler('handleError');
15
16$r = new \ReflectionClass(SomeConstants::class);
17$r->getConstants();
18?>
19--EXPECTF--
20Fatal error: Uncaught ErrorException in %sbug76536.php:%d
21Stack trace:
22#0 [internal function]: handleError(Object(ErrorException))
23#1 {main}
24  thrown in %sbug76536.php on line %d
25