2 function ttrss_error_handler($errno, $errstr, $file, $line, $context) {
5 if (error_reporting() == 0 || !$errno) return false;
7 $file = substr(str_replace(dirname(dirname(__FILE__)), "", $file), 1);
9 if (class_exists("Logger"))
10 return Logger::get()->log_error($errno, $errstr, $file, $line, $context);
13 function ttrss_fatal_handler() {
16 $error = error_get_last();
18 if ($error !== NULL) {
19 $errno = $error["type"];
20 $file = $error["file"];
21 $line = $error["line"];
22 $errstr = $error["message"];
24 if (!$errno) return false;
26 $context = debug_backtrace();
28 $file = substr(str_replace(dirname(dirname(__FILE__)), "", $file), 1);
30 if (class_exists("Logger"))
31 return Logger::get()->log_error($errno, $errstr, $file, $line, $context);
37 register_shutdown_function('ttrss_fatal_handler');
38 set_error_handler('ttrss_error_handler');