<?php set_exception_handler(function (\Throwable $exception) { echo 'Caught: ' . $exception->getMessage() . "\n"; }); set_error_handler(static function (int $severity, string $msg, string $file, int $line): bool { if ((error_reporting() & ~(\PHP_MAJOR_VERSION >= 8 ? 4437 : 0)) === 0) { return false; } echo 'Caught error: ' . $msg . "\n"; return true; }); register_shutdown_function(function () { trigger_error('warn_shutdown_1', \E_USER_WARNING); }); register_shutdown_function(function () { trigger_error('warn_shutdown_2', \E_USER_WARNING); }); register_shutdown_function(function () { throw new \Exception('ex_shutdown_1'); }); register_shutdown_function(function () { // expected to be never executed as after 1 uncaught exception php invokes shutdown, // after 1 uncaught exception in shutdown, php terminates throw new \Exception('ex_shutdown_2'); }); trigger_error('warn_regular_1', \E_USER_WARNING); trigger_error('warn_regular_2', \E_USER_WARNING); throw new \Exception('ex_regular');
You have javascript disabled. You will not be able to edit any code.