Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I keep seeing warning in the log file for this
$element['#below'] = $data['below'] ? menu_tree_output($data['below']) : $data['below'];
Should be changed to
$element['#below'] = isset($data['below']) ? menu_tree_output($data['below']) : array();
Comment | File | Size | Author |
---|---|---|---|
#8 | menu-no-below-full.patch | 6.46 KB | marcingy |
#5 | menu-no-below-test-only.patch | 5.71 KB | marcingy |
#5 | menu-no-below-full.patch | 6.39 KB | marcingy |
#3 | menu-no-below-test-only.patch | 1.5 KB | marcingy |
#3 | menu-no-below-full.patch | 2.18 KB | marcingy |
Comments
Comment #1
bleen CreditAttribution: bleen commentedA couple of quick notes:
- This needs to be fixed in 8.x and then backported to 7.x
- When reporting a bug like this, please indicate what file & line the incriminating code lives in
That said, attached is a quick patch based on your post.
Comment #3
marcingy CreditAttribution: marcingy commentedVersion of the patch with a test away to try and work out why we book tests are failing
Comment #5
marcingy CreditAttribution: marcingy commentedAnd again - this also tidys up the array structure as it was a mess.
Comment #6
marcingy CreditAttribution: marcingy commentedComment #8
marcingy CreditAttribution: marcingy commentedWe need !empty rather than isset. This will also improve performance a small amount as we will reduce calls on menu items that have no children but below set.
Comment #9
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedAlright, thank you. Looks like the tests are catching the problem and that the fix is working.
There is also a coding style clean-up included -- splitting the arrays on to multiple lines -- which is think is OK, here. If we do that, I have only this minor point: Maybe we should also add the usual trailing commas (
),
)?A patch with that + a test only patch, again, would be awesome.
Here.
Here.
Here.
Here.
Here.
Here.
Here.
Here.
Here, too.
Comment #10
marcingy CreditAttribution: marcingy commentedThe test has not changed so there is no benefit what so ever in uploading it as a seperate patch again - we know that existing code fails. I re-roll this later with fixes above.
Comment #11
valthebaldtagging
Comment #12
melsi CreditAttribution: melsi commentedLooked for in D8 but cannot find either watchdog message nor similar code evidence.
Tested in D7 where the code is present. In unpatched state I cannot reproduce the error with multiple hierarchical menu entries. Are there special conditions involved?
Comment #13
valthebaldChanging status
Comment #21
pameeela CreditAttribution: pameeela commentedAs part of the Bug smash initiative, we are triaging issues that are marked 'Postponed (maintainer needs more info)'. Based on the lack of additional information on this ticket, we believe this issue is no longer relevant so I am marking it 'Closed (outdated)'.