-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New ErrorRenderer FlattenException not compatible with old one Debug FlattenException #33929
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
Comments
I think the fact that we define a class alias is the actual issue here. Why are we doing that ? |
@stof that would fix the second problem but the ExceptionController would still get the new FlattenException because of ExceptionListener here would still give a new FlattenException instead of the old one to the Controller |
We did that because the But actually I think the way we did it isn't totally right, because the class alias is created only when the
at this point the class alias doesn't exist. (1) That makes me think the solution at least for this particular problem will be the one we did for (2) Later, we need to fix the (3) Next, we might need to deprecate passing the At least that's my reasoning from afar. |
About the
Thus the solution to this problem would be requiring |
That would deprecate the |
I think we should do this. |
@alexander-schranz could you please check if #33941 solves all the problems? Thanks! |
@yceruto Tested. Fixes both cases 👍 |
…ption usage (yceruto) This PR was merged into the 4.4 branch. Discussion ---------- Keeping backward compatibility with legacy FlattenException usage | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | yes | Tickets | Fix #33929 | License | MIT | Doc PR | - Commits ------- 928363c Keeping backward compatibility with legacy FlattenException usage
@yceruto Hi! Just a question, what are the benefits to remove the original exception from the |
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:This works as expected in 4.3 and in 4.4 you will get an error
Symfony\Component\ErrorRenderer\Exception\FlattenException
given but expectedSymfony\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
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:
So both create and createFromThrowable should be available in 4.4.
Possible Solution
The
Symfony\Component\ErrorRenderer\Exception\FlattenException
should extend from theSymfony\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
The text was updated successfully, but these errors were encountered: