Bug #61091 [Nab]: User-defined error handler run despite at sign (@) error control operator
| From: | chealer at gmail dot com | Date: | Sun, 19 Feb 2012 21:59:54 +0000 |
| Subject: | Bug #61091 [Nab]: User-defined error handler run despite at sign (@) error control operator | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-167634@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=61091&edit=1
ID: 61091
User updated by: chealer at gmail dot com
Reported by: chealer at gmail dot com
Summary: User-defined error handler run despite at sign (@)
error control operator
Status: Not a bug
Type: Bug
Package: *General Issues
PHP Version: 5.3.10
Block user comment: N
Private report: N
New Comment:
I guess it does, but this report is not about error_reporting, it is about the @ error control
operator.
According to the documentation of @, any error message that might be generated by the expression
will be "ignored". Either the PHP interpreter is changed so that this becomes the case,
or, if the current behavior is desired, the documentation is adapted to reflect the actual
semantics.
To be perfectly clear, I am not asking to change the de facto semantics. I am only asking that
whatever semantics is used by the implementation matches the documented semantics.
Previous Comments:
------------------------------------------------------------------------
[2012-02-19 20:24:52] rasmus@php.net
It says, "however you are still able to read the current value of error_reporting
and act appropriately" followed by "Of particular note is that this value will be
0 if the statement that caused the error was prepended by the @ error-control
operator."
To me this says quite clearly that error_reporting will be 0 if the @ was used
and that your custom error handler can read this value and "act appropriately."
------------------------------------------------------------------------
[2012-02-19 19:49:22] chealer at gmail dot com
Rasmus, the part you quoted is about error_reporting() settings, it merely mentions the error
control operator.
My question was, could you quote where "http://www.php.net/set_error_handler [...] explains
that the user-defined error
handler should check the error_reporting level in order to comply with the '@' if so
desired"?
------------------------------------------------------------------------
[2012-02-15 16:53:06] rasmus@php.net
"error_reporting() settings will have no effect and your error handler will be
called regardless - however you are still able to read the current value of
error_reporting and act appropriately. Of particular note is that this value will
be 0 if the statement that caused the error was prepended by the @ error-control
operator."
------------------------------------------------------------------------
[2012-02-15 16:25:42] chealer at gmail dot com
Thanks rasmus, but I do not see this explanation. Could you quote it?
------------------------------------------------------------------------
[2012-02-15 03:45:12] rasmus@php.net
This is very much by design and definitely won't be changed since that would
break all sorts of code. It is also explicitly documented at
http://www.php.net/set_error_handler which
explains that the user-defined error
handler should check the error_reporting level in order to comply with the '@' if
so desired.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=61091
--
Edit this bug report at https://bugs.php.net/bug.php?id=61091&edit=1