Add deprecation warning to show HttpKernel::handle() will catch throwables #45997
+3
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
I suggest that starting from Symfony 7.0 the
HttpKernel
will start to catch\Throwable
and convert them to aResponse
.This was first asked in #16205, I face a similar issue with Runtime component and Bref..
The reason I push for this change is to embrace the request/response workflow of the Kernel without trusting the custom error handler. In an environment where you serve multiple requests with the same PHP process (read: RoadRunner, Swoole, Bref) you would write something like:
(pseudo code of course. Here is a real example)
The
exit(1)
means a hard crash. For Bref Runtime it would result in a 500 error from API-gateway. Since the\Throwable
is caught, the Symfony error handler is not used. If we would not to catch the\Throwable
, then the Symfony error handler would be used, but it would print a Response instead of returning it. (Printing a response will just add HTML on the CLI...)Other PRs and issues related to this:
I'm happy to let the
HttpKernel
to catch the\Throwable
exception right now, but I thought this very conservative PR would have a higher change to get merged.Also note that we do not specify any behaviour on our HttpKernelInterface