Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
[ErrorHandler] Add a command to dump static error pages#58769
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
2ce43b0
to79cfa6e
CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/Tests/Error/PagesDumperTest.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/Tests/Error/PagesDumperTest.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/Command/ErrorDumpPagesCommand.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
d6d7401
to0fc7ceb
CompareI have just moved the command in the Twig bundle, applied most of the review suggestions (and mark them as resolved) and answered to the remaining ones. I don't understand the psalm failure as the arrayNode method of the configuration is used elsewhere without issue. Did I miss something? |
62cd182
to49aa562
Compare
I guess it can be ignored, Psalm does not know the exact type of the "rootNode" here.. and so type it as ParentNode|ArrayDefinition 🤷♂️ |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
The Psalm baseline seems to be build automatically so not sure if I have something to do on my side to "ignore" this error? -- Meanwhile I fixed latest review comments. Is there anything I can do to move forward with PR? 🙂 Thanks |
If we use semantic configuration to configure this command, we have to add a test inhttps://github.com/symfony/symfony/blob/7.3/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/ConfigurationTest.php FYI, we'll also have to updatehttps://github.com/symfony/symfony/blob/7.3/src/Symfony/Bundle/TwigBundle/Resources/config/schema/twig-1.0.xsd. |
Jean-Beru commentedJan 7, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Is it linked to a missing The configuration will be: privatefunctionaddErrorDumperSection(ArrayNodeDefinition$rootNode):void {$rootNode ->children() ->arrayNode('error_dumper') ->addDefaultsIfNotSet() ->children() ->scalarNode('path') ->info('The directory where error pages will be dumped.') ->defaultValue('%kernel.build_dir%/error_pages') ->end() ->arrayNode('status_codes') ->info('The error status codes to dump. By default, all 4xx and 5xx status codes will be dumped.') ->defaultValue([]) ->integerPrototype()->end() ->end() ->end() ->end() ->end() ; } |
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.
Thanks 👍🏼
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/ErrorHandler/Tests/Command/ErrorDumpCommandTest.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/ErrorHandler/Tests/Command/ErrorDumpCommandTest.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/ErrorHandler/Tests/Command/ErrorDumpCommandTest.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
pyrech commentedFeb 28, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
6b9e6fe
to37899b7
Compare
You can ignore it then. |
Uh oh!
There was an error while loading.Please reload this page.
d1a8c60
tob161e14
CompareThank you@pyrech. |
9d84727
intosymfony:7.3Uh oh!
There was an error while loading.Please reload this page.
This PR was merged into the 7.3 branch.Discussion----------Add documentation for `error:dump` command<!--If your pull request fixes a BUG, use the oldest maintained branch that containsthe bug (seehttps://symfony.com/releases for the list of maintained branches).If your pull request documents a NEW FEATURE, use the same Symfony branch wherethe feature was introduced (and `7.x` for features of unreleased versions).-->Fix#20704PR introducing the command:symfony/symfony#58769Commits-------d976d0e Add documentation for error:dump command
Uh oh!
There was an error while loading.Please reload this page.
When a web server cannot handle a request or trigger an error without calling the PHP application, it will return instead its default error pages, ignoring completly the error templates defined by the application (Symfony's default "Oops" error page or overriden one in user's app).
Take for example the case of the simple
/%
url : it will trigger an error on almost all web servers (nginx, apache, cloudflare, etc):In all these cases, web servers returned their default error page.
To avoid that, in some of our projects, we created a Symfony command to dump the application error pages in static HTML files that the web server can render when it encounters an internal error. The idea is to dump these pages at deploy time so there is nothing else to do at runtime.
Here is a sample on how we configured our nginx to use our beautiful error pages:
(Kudos to@xavierlacot for all the hard work and researches on this topic 💛)
We propose to add this command directly to Symfony so everybody can make use of it.
Usage