erorr_reporting() and @ operator
| From: | Benjamin Morel | Date: | Wed, 02 Dec 2020 13:55:57 +0000 |
| Subject: | erorr_reporting() and @ operator | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-112371@lists.php.net to get a copy of this message | ||
Hi internals,
Since PHP 8.0,
error_reporting() started returning a non-zero value when
the @ silence operator is used.
Demo: https://3v4l.org/CovYv
Is this intentional? This breaks scripts that converted all errors to
exceptions, except those where the silence operator was used:
set_error_handler(function ($severity, $message, $file, $line) {
if (error_reporting() === 0) {
return;
}
throw new ErrorException($message, 0, $severity, $file, $line);
});
Thank you,
Benjamin