-
Notifications
You must be signed in to change notification settings - Fork 126
InvalidTag::flattenExceptionBacktrace() corrupts reference arguments #249
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
Thanks for your report, we will have a look at this👍 |
@nikic if I understand the issue correctly, because we are changing the back trace of an exception we are changing references in the rest of the execution flow? I think the best way to keep the behavior we want is to deep clone the exceptions? Or this not possible because it will always have a reference to the origin of the exception? What we tried to do is make exception serialization possible, since a lot of using applications are serializing the output of this library to be able to cache the results. |
If I understand well the trace changing is now impossible http://git.php.net/?p=php-src.git;a=blobdiff;f=UPGRADING;h=f7c6ec0a147ed114a6da73df0db4f82d314af8c4;hp=a98aeab045b126979939f8324cc202c46dea7004;hb=d65d3f5298dcc8d94bcac96e8bf2441dceb393ac;hpb=27ad19c3e8d4fe61ce9c8cec9e50062acf2255c1 This issue is blocking me from integrating Doctum into projects https://github.com/laravel/laravel.com-next/pull/124 How can I help on this one ? |
What I do understand is that from php8 this code will actually work... However we still support php 7.2 and up. We need to address this in the right way. But I don't know yet how without breaking bc. The only thing I can come up with is a deep clone of the exceptions, but I don't know if that will work and keep bc. We need to find out what our options are. I'm not near a computer the upcoming week, so any pr or plan from any contributor is welcome. |
Just some news: I can not find some time soon to fix this issue, feel free to fix it :) |
I created a PR that should fix this issue. A review from you both would be very much appreciated :-D |
Fixed in release 5.2.1 |
Thank you so much !! |
If there are any arguments in the backtrace that are references, InvalidTag::flattenExceptionBacktrace() may corrupt them by converting them to strings. This came up in nikic/PHP-Parser#687.
The underlying PHP bug/feature https://bugs.php.net/bug.php?id=79108 that allows this has been fixed/removed in PHP 8.0, but this still needs a fix in this library in the meantime. It should be possible to remove the references using something like:
The text was updated successfully, but these errors were encountered: