1--TEST-- 2#[\Deprecated]: Exception Handler is deprecated for throwing error handler. 3--FILE-- 4<?php 5 6function my_error_handler(int $errno, string $errstr, ?string $errfile = null, ?int $errline = null) { 7 throw new \ErrorException($errstr, 0, $errno, $errfile, $errline); 8} 9 10set_error_handler('my_error_handler'); 11 12#[\Deprecated] 13function my_exception_handler($e) { 14 echo "Handled: ", $e->getMessage(), PHP_EOL; 15}; 16 17set_exception_handler('my_exception_handler'); 18 19#[\Deprecated] 20function test() { 21} 22 23test(); 24 25?> 26--EXPECTF-- 27Fatal error: Uncaught ErrorException: Function my_exception_handler() is deprecated in Unknown:0 28Stack trace: 29#0 [internal function]: my_error_handler(%d, '%s', '%s', %d) 30#1 {main} 31 thrown in Unknown on line 0 32