Skip to content
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

Issue with menus if over 30 items (500 error from infinite loop) #3266

Open
uglyeoin opened this issue Sep 3, 2024 · 2 comments
Open

Issue with menus if over 30 items (500 error from infinite loop) #3266

uglyeoin opened this issue Sep 3, 2024 · 2 comments

Comments

@uglyeoin
Copy link

uglyeoin commented Sep 3, 2024

Here's a full description including troubleshooting:

https://rockettheme.com/forum/general-discussion/290948-gantry-is-500-error-if-i-add-a-child-to-the-menu?start=10#1458610

If there are over 30 items and a 2 column menu the site crashes.

AbstractMenu.php, sortAll() function sequence in this scenario:

Before it errors it's trying to $instance->sortAll(); the $instance that's set is line 316, 'Get menu items from the CMS.'

This is what calls setGroupToChildren, line 649
$item = $this->items[$key];
if (!$ordering) {
$this->setGroupToChildren($item);

        return;
    }

And then this is that function, on line 700, where it infinitely loops (seemingly, only if there's more than 30 items in the current child group):
protected function setGroupToChildren($item)
{
$groups = $item->groups();
foreach ($groups as $group => $children) {
foreach ($children as $child) {
$child->group = $group;
$this->setGroupToChildren($child);
}
}
}

Weirdly adding a third column but not populating it solves the issue. BUT... doing that creates a copy of a parent menu item in the third column for some reason.

@uglyeoin
Copy link
Author

uglyeoin commented Sep 5, 2024

To add some further detail. Although making 3 columns works. As soon as we add a new menu item as a child to that menu, it stays as 3 columns, but it pushes all of the items back into the first 2 columns again. It then puts "contact us" as a duplicate in the third column for some reason. Weird glitch.

@uglyeoin
Copy link
Author

Further information, even with 3 columns we reach a limit of 34 items. After 35 the system crashes again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant