Skip to content

Instantly share code, notes, and snippets.

@svandragt
Created January 15, 2024 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save svandragt/b303ce2d8d40050c6b9b8a50cb68f756 to your computer and use it in GitHub Desktop.
Save svandragt/b303ce2d8d40050c6b9b8a50cb68f756 to your computer and use it in GitHub Desktop.
<?php
register_shutdown_function('handleShutdown');
function handleShutdown() {
$lastError = error_get_last();
if (null !== $lastError) {
switch ($lastError['type']) {
case E_ERROR:
case E_PARSE:
case E_CORE_ERROR:
case E_CORE_WARNING:
case E_COMPILE_ERROR:
case E_COMPILE_WARNING:
echo 'A fatal error occurred, stopping script execution';
xdebug_break(); // This will trigger the debugger
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment