Created
September 27, 2018 03:56
-
-
Save nim4n136/ffe5499ec6dddfe49c0e604c535fc291 to your computer and use it in GitHub Desktop.
Error Handler php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
error_reporting(0); | |
register_shutdown_function('ShutDown'); | |
include 'include.php'; | |
function catchError($errno, $errstr, $errfile = '', $errline = ''){ | |
echo "Eroor Type : " .$errno. "<br>"; | |
echo "Eroor Message : " . $errstr . "<br>"; | |
echo "Line Number : " . $errline; | |
exit(); | |
} | |
function ShutDown(){ | |
$lasterror = error_get_last(); | |
if(in_array($lasterror['type'],Array( E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR, E_RECOVERABLE_ERROR, E_CORE_WARNING, E_COMPILE_WARNING, E_PARSE))){ | |
catchError($lasterror['type'],$lasterror['message'],$lasterror['file'],$lasterror['line']); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment