Skip to content

500 error page is not customizable #37633

@dvdknaap

Description

@dvdknaap

Symfony version(s) affected: 4.4.10

Description
It's not possible to customize the 500 error page of symfony the error path is hard code and not using the twig load paths.

How to reproduce
Create a template error path shown on https://symfony.com/doc/current/controller/error_pages.html and trigger a 500 error and it will not trigger the template

Possible Solution
Use the twig loader path and include the error file else use the fallback that is used now

Additional context
See file:
vendor/symfony/error-handler/ErrorRenderer/HtmlErrorRenderer.php
#133

 if (!$debug) {
            return $this->include('views/error.html.php', [
                'statusText' => $statusText,
                'statusCode' => $statusCode,
            ]);
        }

#line 342

    private function include(string $name, array $context = []): string
    {
        extract($context, EXTR_SKIP);
        ob_start();
        include __DIR__.'/../Resources/'.$name;

        return trim(ob_get_clean());
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions