-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpKernel] rename ExceptionEvent to ErrorEvent and remove the ErrorException wrapper #34306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ce2218d
to
2d42d18
Compare
$event = new ExceptionEvent($this, $request, $type, $e); | ||
$this->dispatcher->dispatch($event, KernelEvents::EXCEPTION); | ||
if (!$this->dispatcher instanceof \Symfony\Component\EventDispatcher\EventDispatcherInterface) { | ||
@trigger_error('Listening to the "kernel.exception" event is deprecated since Symfony 4.4, listen to "kernel.error" instead.', E_USER_DEPRECATED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how can affected people get rid of the deprecation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we don't have any other alternative here: ppl that hit this code path must bump to v5.
Good news, this affects ppl that implement EventDispatcherInterface
from the contracts ONLY (excluding the one from the component). If such an implementation exists (does it?), it must be very new, and very rare.
…Exception wrapper
2d42d18
to
73e9009
Compare
PR is ready. |
Fine for me. But I don't get why this would be better than #33065 (comment). |
In terms of amount of code, renaming the methods on the It's also a matter of target names - which one makes more sense: My personal preference goes for the latter, also because it is consistent with the |
Smaller diff, we're going to prefer #34309 |
… throwable (nicolas-grekas) This PR was merged into the 4.4 branch. Discussion ---------- [HttpKernel] make ExceptionEvent able to propagate any throwable | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no | Deprecations? | yes | Tickets | - | License | MIT | Doc PR | - An alternative to #34306. As a reminder, the goal of this series of PRs is to remove the `FatalThrowableError` wrapper that we introduced to seamlessly handle throwables when they were introduced in PHP 7. From the changelog of `HttpKernel`: * Deprecated methods `ExceptionEvent::get/setException()`, use `get/setThrowable()` instead * Deprecated class `ExceptionListener`, use `ErrorListener` instead And the final target: removed `Symfony\Component\ErrorHandler\Exception\ErrorException` (`FatalThrowableError` is already deprecated.) Commits ------- 6f67f0e [HttpKernel] make ExceptionEvent able to propagate any throwable
Replaces #34232
This PR gets rid of the
FatalThrowableError
wrapper we introduced when doing the transition from PHP 5 to PHP 7 - to handle allThrowable
in a seamless way.It does so by replacing the
kernel.exception
event by thekernel.error
one. The new name is consistent with theconsole.error
event that we introduced for similar reasons in the Console component.Along the way, some method/classes are renamed.
The
ErrorException
class from theErrorHandler
component is removed.