Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[HttpKernel] Exception after kernel.terminate runs kernel.exception, kernel.response and kernel.finish_request listeners again #45205

Closed
@fancyweb

Description

@fancyweb

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

  1. I think dispatching kernel.exception again can make sense. But we should stop there.

  2. 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions