Skip to content

Commit

Permalink
Adapt app_error_handler() to PHP 8.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
monnerat authored and leenooks committed Aug 5, 2022
1 parent c90dc06 commit f129579
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f129579

Please sign in to comment.