Re: erorr_reporting() and @ operator

From: Date: Wed, 02 Dec 2020 13:58:21 +0000
Subject: Re: erorr_reporting() and @ operator
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-112372@lists.php.net to get a copy of this message
On Wed, Dec 2, 2020 at 2:56 PM Benjamin Morel <benjamin.morel@gmail.com> wrote: > 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 > Search for "error_reporting()" on https://www.php.net/manual/en/migration80.incompatible.php, it discusses exactly this code ;) Regards, Nikita

« previous php.internals (#112372) next »