Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Debug] Mimic __toString php behavior in FlattenException#28879
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
Uh oh!
There was an error while loading.Please reload this page.
13eb183 to1fdaa39Comparenicolas-grekas commentedOct 15, 2018 • 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.
Thanks for the PR. |
1fdaa39 to701a540CompareDeltachaos commentedOct 15, 2018
@nicolas-grekas For the So i don't really see cases where this can leak sensitive data? |
3fa4f16 to0323df8Comparenicolas-grekas commentedOct 17, 2018
Fine for getTraceAsString. Do you have a use case where this would help? |
fabpot commentedOct 17, 2018
|
Deltachaos commentedOct 17, 2018 • 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.
@fabpot if this is not the goal then at least the return type declaration of It the behaivor wanted is that @nicolas-grekas The use case i have mentioned is to access the exception of a failed request in a |
Uh oh!
There was an error while loading.Please reload this page.
fabpot commentedFeb 21, 2019
Any news here? |
4cc7e46 toff2f7d2Compareff2f7d2 to514a1b5CompareDeltachaos commentedFeb 21, 2019
@fabpot have changed the method name to what@nicolas-grekas suggested. Tests have run through. |
fabpot commentedMar 31, 2019
Thank you@Deltachaos. |
…ion (Deltachaos)This PR was merged into the 4.3-dev branch.Discussion----------[Debug] Mimic __toString php behavior in FlattenException| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | n/a| License | MIT| Doc PR | symfony/symfony-docs#The `Symfony\Component\Debug\Exception\FlattenException` object is returned by `Symfony\Component\HttpKernel\DataCollector\ExceptionDataCollector::getException` method, but the docblock of this method indicates that it should return `\Exception` object.As the `FlattenException` class should behave as much as possible like a php `\Exception` object, it should implement the same methods as `\Exception`.This PR is adding `__toString` and `getTraceAsString` methods. Those methods are (in my opinion) the most useful methods of a `\Exception` object. A potential use case (where i am stumbled across this inconsistency) is to get the last exception of a request in a `WebTestCase` using the profiler and printing the trace.Commits-------514a1b5 [Debug] Mimic __toString php behavior in FlattenException
The
Symfony\Component\Debug\Exception\FlattenExceptionobject is returned bySymfony\Component\HttpKernel\DataCollector\ExceptionDataCollector::getExceptionmethod, but the docblock of this method indicates that it should return\Exceptionobject.As the
FlattenExceptionclass should behave as much as possible like a php\Exceptionobject, it should implement the same methods as\Exception.This PR is adding
__toStringandgetTraceAsStringmethods. Those methods are (in my opinion) the most useful methods of a\Exceptionobject. A potential use case (where i am stumbled across this inconsistency) is to get the last exception of a request in aWebTestCaseusing the profiler and printing the trace.