Merge pull request 'Return true in custom error handler for proper suppression' (#89) from mechnich/tt-rss:fix-error-handling into master

Reviewed-on: https://dev.tt-rss.org/tt-rss/tt-rss/pulls/89
This commit is contained in:
fox 2022-10-11 18:57:09 +03:00
commit 7eb711eefa
1 changed files with 3 additions and 2 deletions

View File

@ -43,10 +43,11 @@ function format_backtrace($trace): string {
}
function ttrss_error_handler(int $errno, string $errstr, string $file, int $line): bool {
// return true in order to avoid default error handling by PHP
if (version_compare(PHP_VERSION, '8.0.0', '<')) {
if (error_reporting() == 0 || !$errno) return false;
if (error_reporting() == 0 || !$errno) return true;
} else {
if (!(error_reporting() & $errno)) return false;
if (!(error_reporting() & $errno)) return true;
}
$file = substr(str_replace(dirname(__DIR__), "", $file), 1);