-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] enable ErrorHandler in prod #12081
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
nicolas-grekas
commented
Sep 30, 2014
Q | A |
---|---|
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | #11053, #8281 |
License | MIT |
Doc PR | - |
- a new debug.error_handler service is the registered PHP error handler, with ErrorHandler::register() as factory
- ErrorHandler::register() is patched so that it checks if the currently registered error handler is an instance of ErrorHandler - in which case it returns this instance and don't create a new one.
- DebugHandlersListener now listen to ConsoleEvents and re-injects fatal errors within the $app->renderException code path
- DebugHandlersListener also has a new $scream parameter to control if silenced errors are logged or not
af0ecf4
to
c3d012c
Compare
This PR is ready for review/vote. I updated the patch to have almost no behavioral change but only semantic added-value. |
f3943a9
to
423a286
Compare
423a286
to
4acf5d3
Compare
looks good to me. 👍 |
@@ -6,7 +6,9 @@ | |||
|
|||
<parameters> | |||
<parameter key="debug.debug_handlers_listener.class">Symfony\Component\HttpKernel\EventListener\DebugHandlersListener</parameter> | |||
<parameter key="debug.error_handler.class">Symfony\Component\Debug\ErrorHandler</parameter> |
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 want to introduce more of these params.
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.
agreed
c12db68
to
9bb0f83
Compare
<argument>null</argument><!-- %templating.helper.code.file_link_format% --> | ||
</service> | ||
|
||
<service id="debug.error_handler" class="Symfony\Component\Debug\ErrorHandler" factory-class="Symfony\Component\Debug\ErrorHandler" factory-method="register" public="false"> |
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.
what is this service for?
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.
Now that it is private I can drop it you're right.
I may reintroduce it later to bind it to new configuration options for controlling scope_at and trace_at,
that's why I added it in the first place.
Removing for now.
9bb0f83
to
fac3cc4
Compare
That the console now correctly displays fatal errors is cool. But this will only be working when using the framework bundle. Can this not be handled within the component? |
Having this in the framework bundle allows configuration flexibility. |
Thank you @nicolas-grekas. |
…-grekas) This PR was merged into the 2.6-dev branch. Discussion ---------- [FrameworkBundle] enable ErrorHandler in prod | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #11053, #8281 | License | MIT | Doc PR | - - a new debug.error_handler service is the registered PHP error handler, with ErrorHandler::register() as factory - ErrorHandler::register() is patched so that it checks if the currently registered error handler is an instance of ErrorHandler - in which case it returns this instance and don't create a new one. - DebugHandlersListener now listen to ConsoleEvents and re-injects fatal errors within the $app->renderException code path - DebugHandlersListener also has a new $scream parameter to control is silenced errors are logged or not Commits ------- fac3cc4 [FrameworkBundle] register ErrorHandler at boot time 4acf5d3 [Debug] make screaming configurable 4d0ab7d [FrameworkBundle] enable ErrorHandler in prod