From f129579f459ac2c7b6d1a97d90ffa76042ef801a Mon Sep 17 00:00:00 2001 From: Patrick Monnerat Date: Sat, 15 Jan 2022 11:10:11 +0100 Subject: [PATCH] Adapt app_error_handler() to PHP 8. In an '@ error suppression context, PHP 8 error_reporting() no longer returns 0 but an error mask of errors that cannot be supressed and passes the effective error number to the error handler (instead of 0). Adapt the test in a compatible way. --- lib/functions.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/functions.php b/lib/functions.php index 5746aa5..367385c 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -130,12 +130,13 @@ function app_error_handler($errno,$errstr,$file,$lineno) { debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs); /** - * error_reporting will be 0 if the error context occurred - * within a function call with '@' preprended (ie, @ldap_bind() ); + * error_reporting will be only the non-ignorable error number bits + * if the error context occurred within a function call with '@' + * preprended (ie, @ldap_bind() ); * So, don't report errors if the caller has specifically * disabled them with '@' */ - if (ini_get('error_reporting') == 0 || error_reporting() == 0) + if (!(ini_get('error_reporting') & error_reporting() & $errno)) return; $file = basename($file);