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

New ErrorRenderer FlattenException not compatible with old one Debug FlattenException #33929

Copy link
Copy link
Closed
@alexander-schranz

Description

@alexander-schranz
Issue body actions

Symfony version(s) affected: 4.4-dev

Description

Want to move discussion from #33918 and #33916 to this issue.

The new ErrorRenderer FlattenException is not compatible with the old Debug FlattenException. And in some places you now get the new FlattenException which crashes current project codes.

How to reproduce

1. Case: Create a custom ExceptionController::showAction

Has symfony/debug installed:

use Symfony\Component\Debug\Exception\FlattenException;

public function showAction(Request $request, FlattenException $exception, DebugLoggerInterface $logger = null);

This works as expected in 4.3 and in 4.4 you will get an error Symfony\Component\ErrorRenderer\Exception\FlattenException given but expected Symfony\Component\Debug\Exception\FlattenException

2. Case: FlattenException without Debug installed

In 4.4-dev if a dependency has not debug actually installed the Debug class still exists because of a class_alias in the ErrorRenderer

use Symfony\Component\Debug\Exception\FlattenException;

FlattenException::create(new \Exception(), 200);

This will fail as the new FlattenException doesn't implement create function. If we rename to new from createFromThrowable to create this will the following would fail which is also possible currently:

use Symfony\Component\Debug\Exception\FlattenException;

FlattenException::createFromThrowable(new \Exception(), 200);

So both create and createFromThrowable should be available in 4.4.

Possible Solution

The Symfony\Component\ErrorRenderer\Exception\FlattenException should extend from the Symfony\Component\Debug\Exception\FlattenException to keep BC Compatibility in 4.x this can then be removed in 5.0.

Additional Context

I think its a similiar issue we had with the KernelBrowser and the Client here:

#31762 which was then later fixed in: #31881

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    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.