summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Dolgov <fox@fakecake.org>2025-05-03 08:18:16 +0300
committerAndrew Dolgov <fox@fakecake.org>2025-05-03 08:18:16 +0300
commit01159fa6f8c2421457297914dd42039bc12b826e (patch)
treecf6b5464b3d3be667444316608d369a081016e6d /include
parent4cda1da5c0c511fb2938d8b3683cbef1d75377da (diff)
error handler - dump caught exception/fatal error to debug log if running under CLI SAPI
Diffstat (limited to 'include')
-rw-r--r--include/errorhandler.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/errorhandler.php b/include/errorhandler.php
index c155c9989..2b6d51a7d 100644
--- a/include/errorhandler.php
+++ b/include/errorhandler.php
@@ -49,6 +49,11 @@ function ttrss_error_handler(int $errno, string $errstr, string $file, int $line
$context = format_backtrace(debug_backtrace());
$errstr = truncate_middle($errstr, 16384, " (...) ");
+ if (php_sapi_name() == 'cli' && class_exists("Debug")) {
+ Debug::log("!! Exception: $errstr ($file:$line)");
+ Debug::log($context);
+ }
+
if (class_exists("Logger"))
return Logger::log_error((int)$errno, $errstr, $file, (int)$line, $context);
else
@@ -70,6 +75,11 @@ function ttrss_fatal_handler(): bool {
$file = substr(str_replace(dirname(__DIR__), "", $file), 1);
+ if (php_sapi_name() == 'cli' && class_exists("Debug")) {
+ Debug::log("!! Fatal error: $errstr ($file:$line)");
+ Debug::log($context);
+ }
+
if (class_exists("Logger"))
return Logger::log_error((int)$errno, $errstr, $file, (int)$line, $context);
}