Commit ad3f44e
committed
bug symfony#58289 [HttpKernel] Skip logging uncaught exceptions in
This PR was merged into the 5.4 branch.
Discussion
----------
[HttpKernel] Skip logging uncaught exceptions in `ErrorHandler`, assume `$kernel->terminateWithException()` will do it
| Q | A
| ------------- | ---
| Branch? | 5.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Issues | Fix symfony#57902
| License | MIT
When uncaught exceptions are handled by `ErrorHandler::handleException()`, that method logs them, then calls a callback to let the app know about the exception itself.
This causes two issues:
1. that log happens without context, which leads to symfony#57902
2. logs are duplicated: one by ErrorHandler, twice by the callback
In this PR, I propose to consider that if terminateWithException is configured as a callback, we assume that the app will handle the logging on its own.
Tested in practice, this works nicely.
Adding a test case is quite complex as all this involves many pieces and global state, so I skipped adding one.
Commits
-------
3b87c32 [HttpKernel] Skip logging uncaught exceptions in ErrorHandler, assume $kernel->terminateWithException() will do itErrorHandler, assume $kernel->terminateWithException() will do it (nicolas-grekas)File tree
1 file changed
+14
-0
lines changed- src/Symfony/Component/HttpKernel/EventListener
1 file changed
+14
-0
lines changedLines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
| |||
144 | 145 | | |
145 | 146 | | |
146 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
147 | 161 | | |
148 | 162 | | |
149 | 163 | | |
| |||
0 commit comments