[PHP-NOTES] note 130466 added to language.operators.errorcontrol

[email protected] ("[email protected]") Sun, 31 Aug 2025 14:54:43 +0000
Newsgroups php.notes
Message-ID <[email protected]>
There is an error about error_reporting()'s return value inside an error handler in the documentation.

"Prior to PHP 8.0.0, the error_reporting() called inside the custom error handler always returned 0 if the error was suppressed by the @ operator. As of PHP 8.0.0, it returns the value of this (bitwise) expression: E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR | E_PARSE."

In fact, in PHP 8.0.0+, error_reporting() in an error handler returns $error_reporting & (E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR | E_PARSE), where $error_reporting is the value of the global error_reporting ini directive set, no matter through ini or error_reporting().
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 101.206.224.180)
----
Manual Page -- https://php.net/manual/en/language.operators.errorcontrol.php
Edit        -- https://main.php.net/note/edit/130466
Del: integrated  -- https://main.php.net/note/delete/130466/integrated
Del: useless     -- https://main.php.net/note/delete/130466/useless
Del: bad code    -- https://main.php.net/note/delete/130466/bad+code
Del: spam        -- https://main.php.net/note/delete/130466/spam
Del: non-english -- https://main.php.net/note/delete/130466/non-english
Del: in docs     -- https://main.php.net/note/delete/130466/in+docs
Del: other reasons-- https://main.php.net/note/delete/130466
Reject      -- https://main.php.net/note/reject/130466
Search      -- https://main.php.net/manage/user-notes.php