Fix #1000: Respect error_reporting - #1001
PatchRanger wants to merge 1 commit into
Conversation
bc0ec22 to
1b5c6f8
Compare
|
Travis tests failed not by my fault) I guess, the branch |
Jean85
left a comment
There was a problem hiding this comment.
This is in fact a BC, we cannot accept it as a patch. Sentry has its own error reporting level (Options::getErrorTypes()), which uses the same constants of error_reporting, and is E_ALL by default, which is applied in two points:
sentry-php/src/Integration/ErrorListenerIntegration.php
Lines 77 to 79 in e0b6e8c
sentry-php/src/Integration/FatalErrorListenerIntegration.php
Lines 57 to 59 in e0b6e8c
Applying this change would mean intersecting the two settings.
| } else { | ||
| $errorAsException = new SilencedErrorException(self::ERROR_LEVELS_DESCRIPTION[$level] . ': ' . $message, 0, $level, $file, $line); |
There was a problem hiding this comment.
This is something different. A SilencedErrorException is something like @foo(), related to the @ silencing operator.
There was a problem hiding this comment.
I see that it was designed as related to @. I see that Sentry has its own reporting level. My point is that the case of intentionally silenced by tweaking error_reporting warnings should be handled the same way.
Let's review how it should work in such particular case:
- I have
error_reporting=E_ALL. - My Sentry error reporting is set to
WARNING: I want to see in my Sentry dashboard everything that equals or aboveWARNING. - Symfony decides to workaround missed cache issue by tweaking
error_reportinglevel. The idea is to intentionally "skip" particular warning. I don't want to see it in my Sentry dashboard, it was silenced - just by another way than@, see https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/Kernel.php#L431 .
In my view tweaking error_reporting level should be considered as another way of intentionally silencing @.
This is in fact a BC, we cannot accept it as a patch.
Ok, I understand. I am going to rebase it to another branch once we reconcile the most appropriate way of dealing with this issue.
There was a problem hiding this comment.
Applying this change would mean intersecting the two settings.
You made me think, thank you :-)
I think there is no intersection:
- Sentry
Options::getErrorTypes()controls whether to report or not. It uses the same constants and defaults toE_ALL- but is totally independent oferror_reportingsetting: it is not controlled by tweakingerror_reporting. - Globally defined
error_reportingimpacts how to report the error: either silenced or usual way. It doesn't matter howerror_reportingwas tweaked: either by@or manually - does it? - There is another option (
setCaptureSilencedErrors), which makes to report even silenced errors.
In my view it works almost the same way as we already have: just the case of 0 === error_reporting() was expanded to $level & error_reporting(). Isn't it?:)
1b5c6f8 to
26c6041
Compare
|
I think this patch is correct and fixes an issue. |
That is technically correct; but we already handle the bitmask elsewhere, which I linked in my review message #1001 (review). Those two pieces of code interact with this change, in a way that IMO is not correct. With this patch, we would have this situations:
So, bottom line, I don't understand what you want to achieve with this patch. If you do not want some error reported, you should simply change your Sentry |
I want )) I want all |
|
Understood. Silencing errors through hot-swapping Nicolas suggested to avoid the error handler approach at all and I would like to evaluate his suggestion, but that's a long-run fix, since it would probably require a new major version for this bundle. In the meantime, you can work around your issue by ignoring the events server side, or using a |
The real reason, as it's written in a comment just before the offending line, is that silencing errors using the
I don't think that this impacts this package as it may be used without the bundle part, but it's related to getsentry/sentry-symfony#322 for sure
I think I get what you want and you're absolutely correct in saying that it's not possible right now. According to the |
|
TBH I don't think there is any BC break to consider here. That's a bug. Fixing any bug can be considered a BC break. Here, I wouldn't expect any app to require that an error level excluded by the bitmask would still be reported. If any app does so, it's one that is tightly coupled to this specific error handler, with a behavior that diverges from what another app relying on standard PHP behavior would expect. |
|
Unfortunately the |
|
Yes we could, and I would make it the default value, but only in 3.0 due to BC, again. |
@Jean85 If we extend this PR with switching default value of
Cons:
|
No, every big or small change to the defaults is still a BC and we cannot do it, also in consideration of what I said previously about the fact that people never reported this before and thus I assume that they don't consider this a bug but rather a feature or something that still works fine for them as-is. What should be done is make the |
|
I'm closing this because it's pretty old, and because I think we fixed it in #1196 |
Fix #1000