Cristiano Magro
2017-10-02 be60eb2757f94c509f7573039166392676d65cb0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
 
 
if (!function_exists("fatal_handler")) {
 
    function fatal_handler() {
        $errfile = "unknown file";
        $errstr = "shutdown";
        $errno = E_CORE_ERROR;
        $errline = 0;
 
        $error = error_get_last();
 
        if ($error['type'] === E_ERROR || $error['type'] === E_CORE_ERROR) {
            $result = print_r($error, true);
 
            $headers = "From: assistenza.pro@vola.it\r\n";
            $headers .= "Subject: Fatal error rilevato\r\n";
            //$headers .= "MIME-Version: 1.0\r\n";
            //$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
 
            error_log($result, 1, "cristiano.magro@vola.it", $headers);
        }
    }
 
    register_shutdown_function("fatal_handler");
}