|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80548 Value or error_reporting() within handler with errors suppressed is 4437, not 0
Submitted: 2020-12-24 10:24 UTC Modified: 2020-12-24 12:05 UTC
From: dregad at mantisbt dot org Assigned:
Status: Verified Package: Documentation problem
PHP Version: 8.0.0 OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2020-12-24 10:24 UTC] dregad at mantisbt dot org
According to set_error_handler documentation [1],
"current value of error_reporting [...] will be 0 if the statement that caused the error was prepended by the @ error-control operator."

This works as documented with PHP 7.4, but not in 8.0.0 where error_reporting = 4437.

I'm not sure whether this desired behavior or not, but if it is then documentation is incorrect.


Test script:
function error_handler( $p_type, $p_error, $p_file, $p_line ) {
	echo "error_reporting in handler: ", error_reporting(), PHP_EOL;
set_error_handler( 'error_handler' );

Expected result:
error_reporting = 0

Actual result:
error_reporting = 4437
(with PHP 7.4, error_reporting = 0 as expected)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-12-24 12:05 UTC]
-Status: Open +Status: Verified
 [2020-12-24 12:05 UTC]
This is a deliberate change, and already documented in the
migration guide[1] (search for "the @ operator").  It is indeed
not yet documented in the manual proper.

[1] <>
 [2020-12-24 12:29 UTC] dregad at mantisbt dot org
Thanks for the fast response.

I did check the migration guide, but for some reason this bit escaped my attention. Guess I need glasses ;-)

Merry Xmas
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Feb 28 16:01:33 2024 UTC