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.
This commit is contained in:
Patrick Monnerat 2022-01-15 11:10:11 +01:00 committed by Deon George
parent c90dc06af2
commit f129579f45

View File

@ -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);