Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[HttpKernel] Wrong template is rendered when configuring an exception status code #44433

Copy link
Copy link
Closed
@micheh

Description

@micheh
Issue body actions

Symfony version(s) affected

5.4.0

Description

@lyrixx added a way to configure the status code of an exception (in #42244). When configuring the status code of an exception, the HTTP status code of the response is set as expected. However, the rendered HTML template does not seem to take the configured status code in account and Symfony will render the template as if the status code was not set.

How to reproduce

Use the config:

framework:
    exceptions:
        Doctrine\ORM\EntityNotFoundException:
            status_code: 404

Then throw an EntityNotFoundException. The HTTP status code will be 404, but the rendered template (both in the debug exception template and the production template) will show 500 Internal Server Error.

Possible Solution

Maybe the exceptions Mapping should also be used in the Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer?

Additional Context

The status code of Symfony\Component\ErrorHandler\Exception\FlattenException::createFromThrowable is used.

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.