-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[TwigBundle] Deprecating error templates for non-html formats and using ErrorRenderer as fallback #31398
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
src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.atom.twig
Outdated
Show resolved
Hide resolved
752e607
to
efaf91e
Compare
src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php
Outdated
Show resolved
Hide resolved
Hi @OskarStark thanks for your review, but they aren't part of this PR (see description), the last commit should be reviewed for now. Please, move them to #31065 to track them in the right place ;) |
dafcc21
to
eea898f
Compare
eea898f#diff-21899d8070b2bcedfb8ab7f6993331deR73 I have a problem with the ErrorHandler in functional tests, it does not work because the |
src/Symfony/Bundle/TwigBundle/Controller/PreviewErrorController.php
Outdated
Show resolved
Hide resolved
eea898f
to
61d2b9a
Compare
Status: Needs work |
Check later if #31868 solve this issue #31398 (comment). |
@yceruto Yes, it should fix the issue. I found it while reviewing your PR and Nicolas kindly fixed it. It will soon be on all branches so that you can rebase and see if that works (I tested locally and it worked well). |
@fabpot perfect!! thanks. |
61d2b9a
to
c2f4fc2
Compare
35755ef
to
46f9183
Compare
requires #32693 to make it work properly |
018d4f3
to
b95087c
Compare
b95087c
to
9266107
Compare
9266107
to
bf0c24a
Compare
…ode (preview mode) (yceruto) This PR was merged into the 4.4 branch. Discussion ---------- [ErrorRenderer] Allow disabling debug content in debug mode (preview mode) | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT Required by #31398 to show a preview mode of the error for each content format. Usage: https://github.com/symfony/symfony/pull/31398/files#diff-9ff5216ab011f5e48c7835d4138bf825R42 Note that you can't enable the debug content in non-debug mode via `X-Debug`. I also added more tests. Commits ------- a6bef5e Allow disabling debug content in debug mode (preview mode)
It took time, but here we go, this is in now. Thank you very much @yceruto. |
…formats and using ErrorRenderer as fallback (yceruto) This PR was merged into the 4.4 branch. Discussion ---------- [TwigBundle] Deprecating error templates for non-html formats and using ErrorRenderer as fallback | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - In the previous [PR](#31065) we created a new mechanism to render any PHP error/exception in a formatted string, which if the FB is enabled, would return an HTTP Response according to the preferred Request format (html, json, xml, txt, etc.), but when installing the TwigBundle this rendering mechanism is replaced by the current ExceptionController. This ExceptionController allows us to render custom error pages based on Twig in many formats, just what is already supported with the new ErrorRenderer component, so let's deprecate this in favor of the native. Commits ------- bf0c24a Deprecating error templates for non-html formats and using ErrorRenderer
This PR was merged into the 5.0-dev branch. Discussion ---------- [TwigBundle] remove deprecations and fix tests | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | yes <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | | License | MIT | Doc PR | Removing deprecations from #31398 which should also fix tests in master as I removed some legacy code like (`exception_controller: ~ # to be removed in 5.0 relying on default`) while resolving conflicts when merging 4.4 into master. Commits ------- 452f66d [TwigBundle] remove deprecations
…e new ErrorRenderer mechanism (yceruto) This PR was merged into the 4.4 branch. Discussion ---------- [WebProfilerBundle] Decoupling TwigBundle and using the new ErrorRenderer mechanism | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | #31398 (comment) | License | MIT | Doc PR | - Commits ------- 846d3e0 Decoupling TwigBundle and using the new ErrorRenderer mechanism
… the error renderer mechanism (yceruto) This PR was merged into the 4.4 branch. Discussion ---------- Added new ErrorController + Preview and enabling there the error renderer mechanism | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | yes | Tests pass? | yes (deps=high failure is normal) | Fixed tickets | - | License | MIT | Doc PR | TODO After deprecating the `ExceptionController` in TwigBundle (refs #31398) the `twig.exception_controller` config key becomes useless as feature provided by TwigBundle, while the preview controller is taking more relevance for the error renderer mechanish. **Proposal** * Deprecate the `twig.exception_controller` config key in favor of `framework.error_controller` with default `ErrorController` that activates the error renderer mechanism through the current `ExceptionListener`, meaning also that `DebugHandlersListener::onKernelException` method becomes useless too. * Deprecate the `PreviewErrorController` from TwigBundle in favor of similar in FrameworkBundle. So you no longer need to install TwigBundle to create a custom error controller or check the preview output of an error renderer (included `TwigHtmlErrorRenderer`). Btw this would fix #31398 (comment), removing here workaround in SecurityBundle. TODO: - [x] Update CHANGELOG & UPGRADE files - [x] Add tests WDYT? Commits ------- b79532a Add ErrorController to preview and render errors
… the error renderer mechanism (yceruto) This PR was merged into the 4.4 branch. Discussion ---------- Added new ErrorController + Preview and enabling there the error renderer mechanism | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | yes | Tests pass? | yes (deps=high failure is normal) | Fixed tickets | - | License | MIT | Doc PR | TODO After deprecating the `ExceptionController` in TwigBundle (refs symfony/symfony#31398) the `twig.exception_controller` config key becomes useless as feature provided by TwigBundle, while the preview controller is taking more relevance for the error renderer mechanish. **Proposal** * Deprecate the `twig.exception_controller` config key in favor of `framework.error_controller` with default `ErrorController` that activates the error renderer mechanism through the current `ExceptionListener`, meaning also that `DebugHandlersListener::onKernelException` method becomes useless too. * Deprecate the `PreviewErrorController` from TwigBundle in favor of similar in FrameworkBundle. So you no longer need to install TwigBundle to create a custom error controller or check the preview output of an error renderer (included `TwigHtmlErrorRenderer`). Btw this would fix symfony/symfony#31398 (comment), removing here workaround in SecurityBundle. TODO: - [x] Update CHANGELOG & UPGRADE files - [x] Add tests WDYT? Commits ------- b79532ab0e Add ErrorController to preview and render errors
In the previous PR we created a new mechanism to render any PHP error/exception in a formatted string, which if the FB is enabled, would return an HTTP Response according to the preferred Request format (html, json, xml, txt, etc.), but when installing the TwigBundle this rendering mechanism is replaced by the current ExceptionController.
This ExceptionController allows us to render custom error pages based on Twig in many formats, just what is already supported with the new ErrorRenderer component, so let's deprecate this in favor of the native.