Advertisement
Guest User

Untitled

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