-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Expected behavior
When error reporting is set to Warning, then Bugsnag shouldn’t report silenced PHP errors. For example, the following code shouldn’t report a warning:
@unlink( '/path/to/inexistent/file.jpg' );
Observed behavior
Bugsnag reports PHP warnings for code that is silenced with an @
.
Steps to reproduce
- Put this code in functions.php of your theme and reload the page.
@unlink( '/path/to/inexistent/file.jpg' );
- See error in the dashboard.
I’m not sure, but this logic might be what causes the warning to be reported:
PHP’s documentation for error control operators clearly states:
If you have set a custom error handler function with
set_error_handler()
then it will still get called, but this custom error handler can (and should) callerror_reporting()
which will return0
when the call that triggered the error was preceded by an@
.
In shouldIgnoreErrorCode()
, the function might return without checking error_reporting()
. So I’m guessing that this is why silenced errors are reported.
Version
Bugsnag: 1.3.1
WordPress: 5.0.3
Additional information
Tell me if you need some more information.