for example, I do this:
$var = ss; //неопределённая константа, например file_put_contents('1.log', var_export(error_get_last(), true)); As a result, I get null
Real code example:
function error_handler($errno, $errstr, $errfile, $errline) { //... } function fatal_error_handler() { chdir($_SERVER['DOCUMENT_ROOT'] . '/dsm2.7f2_local/dsm2'); $error = error_get_last(); if ($error && $error['type'] == E_ERROR) { sendErrorMessage('troopermanowar@gmail.com', 'Error', 'Fatal error!'); error_handler($error['type'], $error['message'], $error['file'], $error['line']); } } function sendErrorMessage($email, $subject, $msg) { //... } error_reporting(-1); ini_set('display_errors', 'off'); set_error_handler("error_handler"); register_shutdown_function('fatal_error_handler');
$var[];, this is Fatal error - Jonny Manowarregister_shutdown_function(function(){ if (!($error = error_get_last())){ return;} file_put_contents('1.log', var_export($error, true));});. Onlyregister_shutdown_function- must be at the beginning of the program. Fatals after such an announcement will fall into kollbek. - Goncharov Alexander