Description
Symfony version(s) affected
All
Description
If a kernel.terminate
listener throws an exception, HttpKernel
ends up dispatching kernel.exception
again.
Then, if a kernel.exception
listener sets a response, kernel.response
is redispatched a second time while the response has already been sent (a lot of "useless" code is executed).
Finally, kernel.finish_request
is always redispatched a second time.
How to reproduce
Throw an exception in a kernel.terminate
listener.
Possible Solution
-
I think dispatching
kernel.exception
again can make sense. But we should stop there. -
We can also stop before dispatching it.
Also if this is really a wrong behavior, the subject is probably sensible, I don't think we can treat it as real a bug fix, we would need to deprecate it first.
Additional Context
No response