-
-
Notifications
You must be signed in to change notification settings - Fork 481
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
ArrayableLink in Statamic >4.32 causes infinite loop due to array augmentation #9105
Comments
We've reverted #8928 in the latest release which I believe was the cause of this issue. |
@duncanmcclean I have the same issue at exactly 4.32.0 and I found my way here. After upgrading my site times out. The fix @mkwia suggests works. I am not sure I understand why this fails, in my case it seems like it's part of a code that uses json_encode in some entries that I use as part of a collection that defines a "mega menu" like part of the website. I am guessing json_encode causes some kind of infinite loop. Any ideas? To be honest, I am not sure why this was changed at the first place, a link should be a link if I wanted to get the entry data I would use an Entry relationship field instead. I heavily use links and augmenting each of them to bring the whole entry seems like quite a huge performance hit. Not really blaming anyone (tone is sometimes hard to read in text) just trying to understand how I should move forward. |
Okay, re-opening and we can take a further look. There was a couple other augmentation / infinite loop issues that PR caused so I assumed it would fix this one too but obviously not.
I think it was added so you can do things like There's probably something we can do to avoid the infinite loop. |
@afonic What does your template look like? I can't reproduce the bug using the original reproduction steps. |
@duncanmcclean it's something like this:
I am trying to filter out items until I find what causes it, in the |
Just to confirm, it isn't fixed if you try upgrading to the latest version? |
Nope, it is fixed after reverting back to v4.31 or just reverting the changes made to I will investigate further during the weekend. |
I managed to do some tests for this, it seems to happen only in nested However I failed to reproduce it in a clean install so I just changed my blueprints around to move past this. |
We're able to recreate this with links when they're referring to each other. Ex: Page A links to Page B, and Page B links to Page A, they are also nested inside sections. The fix mkwia suggested with swapping to a Page A
Page B
|
Bug description
After upgrading to Statamic 4.33, some of our sites became broken as a result of the changes introduced in #8911
In a situation where
Link A -> Link B -> Link C -> Link A
the
toAugmentedArray
method causes an infinite loop which breaks the site.When testing locally we were able to resolve this by changing
toAugmentedArray
totoShallowAugmentedArray
oncms/src/Fieldtypes/Link/ArrayableLink.php
Line 17 in 8a60959
This issue seems similar to #9012
If we verify this fully we will submit a pull request.
How to reproduce
Create a link recursion as described above on versions of statamic > 4.32.
We have not been able to consistently reproduce this on all sites but it seems to affect both regex and runtime parsers.
We will update this issue if we find any additional information on this
Logs
No response
Environment
Installation
Fresh statamic/statamic site via CLI
Antlers Parser
None
Additional details
No response
The text was updated successfully, but these errors were encountered: