Closed nikic closed 4 years ago
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. I do fully understand that the hacking we are doing is very odd. And should not be done in all situations.
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 will post an update if I start working on this one.
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
Fixed in release 5.2.1
Thank you so much !! https://github.com/code-lts/doctum/releases/tag/v5.0.2
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 https://github.com/nikic/PHP-Parser/issues/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: