Environment
How do you use Sentry?
Self hosted 21.2.0
Which SDK and version?
bobvandevijver@webdev:/var/www/dev$ composer show | grep sentry
sentry/sdk 3.1.0 This is a metapackage shipping sentry/sentry with a recommended HTTP client.
sentry/sentry 3.2.0 A PHP SDK for Sentry (http://sentry.io)
sentry/sentry-symfony 4.0.3 Symfony integration for Sentry (http://getsentry.com)
We're using PHP 7.3.27 on Debian 10. The issue started after upgrading to v4 of the sentry/sentry-symfony. This upgrade included:
| Package |
Old version |
New version |
| sentry/sdk |
2.2.0 |
3.1.0 |
| sentry/sentry |
2.5.2 |
3.2.0 |
| sentry/sentry-symfony |
3.5.3 |
4.0.3 |
Steps to Reproduce
Symfony tries to silence an include warning during the HTTP Kernel initialization, as the container cache is allowed to not exist. If that is the case, the container variables is reset and the application should continue without any notification whatsoever. The error reporting is restored directly after the "critical" part in the finally handler.
See the Kernel class implementation of Symfony, line 443 for the error level adjustment, line 469 for the line that generates the warning and the finally block on 480-482 that restores the error reporting.
This means that #1183 and #1087 are probably related to this particular issue.
For this particular case the line marked as broken code in #1183 was actually doing its job:

So, a small reproduction would be:
$errorLevel = error_reporting(\E_ALL ^ \E_WARNING);
try {
include 'non-existing-file.php';
} finally {
error_reporting($errorLevel);
}
Expected Result
The error should not be logged into Sentry, as it is suppressed using an explicit error_reporting call.
Actual Result
But is isn't...

Environment
How do you use Sentry?
Self hosted 21.2.0
Which SDK and version?
We're using PHP 7.3.27 on Debian 10. The issue started after upgrading to v4 of the
sentry/sentry-symfony. This upgrade included:Steps to Reproduce
Symfony tries to silence an include warning during the HTTP Kernel initialization, as the container cache is allowed to not exist. If that is the case, the container variables is reset and the application should continue without any notification whatsoever. The error reporting is restored directly after the "critical" part in the finally handler.
See the Kernel class implementation of Symfony, line 443 for the error level adjustment, line 469 for the line that generates the warning and the finally block on 480-482 that restores the error reporting.
This means that #1183 and #1087 are probably related to this particular issue.
For this particular case the line marked as broken code in #1183 was actually doing its job:
So, a small reproduction would be:
Expected Result
The error should not be logged into Sentry, as it is suppressed using an explicit
error_reportingcall.Actual Result
But is isn't...