Re: erorr_reporting() and @ operator
| From: | Benjamin Morel | Date: | Wed, 02 Dec 2020 14:13:59 +0000 |
| Subject: | Re: erorr_reporting() and @ operator | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-112373@lists.php.net to get a copy of this message | ||
Thanks for the pointer, Nikita.
I think the updated example (using
error_reporting() & $errno) fails to
mimic exactly what error_reporting() === 0 did, though.
Say your php.ini mutes E_WARNING, for example:
error_reporting = E_ALL & ~E_WARNING
Checking for error_reporting() === 0 allowed to only ignore @-suppressed
statements, but still throw an exception on E_WARNING, ignoring the
error_reporting set in php.ini.
OTOH, checking for error_reporting() & $errno still allows to
ignore @-suppressed statements, but **also ignores E_WARNING configured in
php.ini**, which is not always what userland code wants.
I'm not sure how userland code can now replicate the old behaviour, i.e.
specifically detect the @ operator?
— Benjamin