Edit report at https://bugs.php.net/bug.php?id=61747&edit=1
ID: 61747
Comment by: anon at anon dot anon
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.4.0
Block user comment: N
Private report: N
New Comment:
What a lot of fuss about nothing.
Previous Comments:
------------------------------------------------------------------------
[2012-04-17 02:06:55] chealer at gmail dot com
No what? It's not fine not to treat suppressed errors differently?
------------------------------------------------------------------------
[2012-04-17 02:00:40] [email protected]
No, I think a custom error handler should make good use of the silence
operator.
There are all kinds of interesting things you can do with it. But yes, if you
want to ignore it entirely, that is fine too.
------------------------------------------------------------------------
[2012-04-17 01:40:34] chealer at gmail dot com
Right. So, the documentation is saying custom error handlers should treat
suppressed errors differently. You are saying it is fine not to do that.
I think your version is right.
------------------------------------------------------------------------
[2012-04-17 00:59:34] [email protected]
Right, it says "should" not "must". If you choose to not treat @ differently,
then you obviously don't need to call error_reporting() from your handler.
------------------------------------------------------------------------
[2012-04-17 00:36:29] chealer at gmail dot com
You write:
If you choose to treat @-preceded errors like any other error, that's fine.
Yet http://ca3.php.net/manual/en/language.operators.errorcontrol.php says a
custom error handler should call error_reporting().
So why should a custom error handler which chooses to treat @-preceded errors
like any other error call error_reporting()?
You write:
By default PHP ignores errors from calls preceded by @, but since you are
writing your own you should have the power to override any and all such
defaults.
I'm not sure I would say that custom error handlers *should* have the power to
override error suppression, but I certainly understand that it can be useful.
In any case, offering that flexibility doesn't have to make it more complicated
to write a simple custom handler. set_error_handler() could simply have an
argument to control whether the callback is called even on normally suppressed
errors.
------------------------------------------------------------------------
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=61747
--
Edit this bug report at https://bugs.php.net/bug.php?id=61747&edit=1