Advertisement
Guest User

Untitled

a guest
Sep 24th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.90 KB | None | 0 0
  1. ini_set('display_errors', 'On');
  2. ini_set('html_errors', 0);
  3.  
  4. // ----------------------------------------------------------------------------------------------------
  5. // - Error Reporting
  6. // ----------------------------------------------------------------------------------------------------
  7. error_reporting(-1);
  8.  
  9. // ----------------------------------------------------------------------------------------------------
  10. // - Shutdown Handler
  11. // ----------------------------------------------------------------------------------------------------
  12. function ShutdownHandler()
  13. {
  14.     if(@is_array($error = @error_get_last()))
  15.     {
  16.         return(@call_user_func_array('ErrorHandler', $error));
  17.     };
  18.  
  19.     return(TRUE);
  20. };
  21.  
  22. register_shutdown_function('ShutdownHandler');
  23.  
  24. // ----------------------------------------------------------------------------------------------------
  25. // - Error Handler
  26. // ----------------------------------------------------------------------------------------------------
  27. function ErrorHandler($type, $message, $file, $line)
  28. {
  29.     $_ERRORS = Array(
  30.         0x0001 => 'E_ERROR',
  31.         0x0002 => 'E_WARNING',
  32.         0x0004 => 'E_PARSE',
  33.         0x0008 => 'E_NOTICE',
  34.         0x0010 => 'E_CORE_ERROR',
  35.         0x0020 => 'E_CORE_WARNING',
  36.         0x0040 => 'E_COMPILE_ERROR',
  37.         0x0080 => 'E_COMPILE_WARNING',
  38.         0x0100 => 'E_USER_ERROR',
  39.         0x0200 => 'E_USER_WARNING',
  40.         0x0400 => 'E_USER_NOTICE',
  41.         0x0800 => 'E_STRICT',
  42.         0x1000 => 'E_RECOVERABLE_ERROR',
  43.         0x2000 => 'E_DEPRECATED',
  44.         0x4000 => 'E_USER_DEPRECATED'
  45.     );
  46.  
  47.     if(!@is_string($name = @array_search($type, @array_flip($_ERRORS))))
  48.     {
  49.         $name = 'E_UNKNOWN';
  50.     };
  51.  
  52.     return(print(@sprintf("%s Error in file \xBB%s\xAB at line %d: %s\n", $name, @basename($file), $line, $message)));
  53. };
  54.  
  55. $old_error_handler = set_error_handler("ErrorHandler");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement