Skip to content

Commit f129579

Browse files
monneratleenooks
authored andcommitted
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.
1 parent c90dc06 commit f129579

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/functions.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,13 @@ function app_error_handler($errno,$errstr,$file,$lineno) {
130130
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
131131

132132
/**
133-
* error_reporting will be 0 if the error context occurred
134-
* within a function call with '@' preprended (ie, @ldap_bind() );
133+
* error_reporting will be only the non-ignorable error number bits
134+
* if the error context occurred within a function call with '@'
135+
* preprended (ie, @ldap_bind() );
135136
* So, don't report errors if the caller has specifically
136137
* disabled them with '@'
137138
*/
138-
if (ini_get('error_reporting') == 0 || error_reporting() == 0)
139+
if (!(ini_get('error_reporting') & error_reporting() & $errno))
139140
return;
140141

141142
$file = basename($file);

0 commit comments

Comments
 (0)