-
-
Notifications
You must be signed in to change notification settings - Fork 101
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
Uncaught ErrorException: var_export does not handle circular references #832
Comments
Downgrading to |
@genesiscz @bartbrinkman I added an extra check for recursiveness before doing the var_export. Could you give 1.37.5 a try? |
@timvandijck Still broken with 1.37.5 |
Can you help me understand what the clipboard means? And isn't doing this check just resulting in Ray not receiving what it should? |
In my case, this fix doesn't help, because I have magic __debugInfo() in my BaseModel which is being checked for recursiveness but results in false negative because I am redacting some of the key-values because of other dumpings (including ray). My print_r looks like this:
Unfortunatelly even after commenting these methods, it won't start working. Even worse, the print_r is now resulting in memory error: PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 803213312 bytes) in /.../vendor/spatie/ray/src/Payloads/LogPayload.php on line 84 Maybe it's a bug in PHP not being able to detect the RECURSION because I have some weird recursion there? To be honest, I can't even find a documented |
It was added to support the new copy button that allows you to copy the output in the Ray app. We need to send it in a different way (var_export) to make it usefull. The copy button will not be shown if we detect a circular reference because it's hard to output that in a string format and var_export doesn't even support it. Most of the time these aren't the variables you would want to copy anyway. Anyway: thank you for the input, I'm going to try and replicate it and see how we can resolve this. |
Shouldn't we revert this nice to have feature so that the core feature of Ray can be used? It's better to re-submit the feature again in the future with better tests etc. |
Just to elaborate on what happens:
I understand this could be even fixed on my side, but since the recursion is in a library and a property I use in BaseModel, there's no way to fix this on my side. Anyway, I think it would be a good idea to even have the ability to switch off this feature as I can imagine the print_r itself on top of var_export can be memory and time consuming and sometimes older version of ray itself slow down the tests a lot if I have ray open (and pausing unfortunatelly doesn't work - I have to close ray for it to be fast again) |
I was able to replicate scenario's that triggered the problems that were mentioned. I now added a more robust implementation to log variables. As far as my own test scenario's go this seems to resolve all issues. It has been added to release 1.37.6. In the future we might add some extra options to skip exporting these variables for when you want things to be faster like in tests. |
I can confirm this resolved the issue. Thank you! Although, is there a way to force the depth to be deeper?
I kinda like the clipboard feature, but hitting depth 5 is pretty easy a lot of times:
|
have the same problem on 1.32, all I did was throw an exception, and log the exception with ray. Edit: when I set |
I am on 1.33.0 on laravel-ray and 1.37.7 on ray itself. Still happens on that version? |
Dear contributor, because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it. |
Describe the bug
When there's a circular reference in an object, I am getting a
PHP Warning: Uncaught ErrorException: var_export does not handle circular references in /.../vendor/spatie/ray/src/Payloads/LogPayload.php:64
even though I am on 1.37.3 version which has try try/catchIt is quite weird because I thought that ErrorException is a children of Exception. It is even more weird that I am getting out of memory exception in the Ray itself on the same line.
Versions
The text was updated successfully, but these errors were encountered: