Skip to content

Instantly share code, notes, and snippets.

View mstrokin's full-sized avatar

Michail Strokin mstrokin

View GitHub Profile
@mstrokin
mstrokin / gist:3c4a1a4b3c82584bbc44
Created February 4, 2016 12:17
catch exceptions/errors (die on fatal error)
function _catch_fatal_error() {
$error = error_get_last();
if (($error['type'] === E_ERROR) || ($error['type'] === E_USER_ERROR)|| ($error['type'] === E_USER_NOTICE)) {
// fatal error has occured
$msg = date("Y-m-d H:i:s")."|FATAL_ERROR: Request:" .$_SERVER['REQUEST_URI']."|". $error['type']. " |Msg : ".$error['message']." |File : ".$error['file']. " |Line : " . $error['line'];
echo $msg;
die();
}
}
function _log_error( $num, $str, $file, $line, $context = null )