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.
On some pages I get this error two times.
After some digging I think it is because a variabele is sometimes an array, but sometimes just text.
The variables are $menu_names in the function menu_tree_build(), and $title in function menu_block_set_title().
Comment | File | Size | Author |
---|---|---|---|
#4 | 2349407-deleted-menu-prevent-more-errors.patch | 1.43 KB | Dave Reid |
#1 | menu_block-fix-menu_tree_build-2349407--1.patch | 979 bytes | yerlix |
Comments
Comment #1
yerlix CreditAttribution: yerlix commentedI've tried to solve it myself.
After stumbling on the same issue but for version 2.3 (https://www.drupal.org/node/1978528), I've tried to use that patch. Without success.
Then I've tried to use that code for version 2.4 which did the trick.
This will be my first patch so just tell me if I'm doing something wrong or not by the standards.
Comment #2
Dave ReidHaving $config['menu_names'] as an array sounds like very broken behavior, and is not actually supported by Menu Block. I would be interested to know how this happened in the first place.
Comment #3
Dave ReidAh, I see. Sounds like a menu was deleted, but a menu block still was being output. Hmm.
Comment #4
Dave ReidI actually think having the PHP notice is a *good* thing since it needs to be addressed. This is the same as core's menu_block_view() which throws the same PHP notice. But we can prevent further errors too with this patch.
Comment #5
Dave ReidGoing to merge this over to #1978528: Two undefined indexes found: in menu_tree_build() and title in menu_block_get_title()