Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Warning: Invalid argument supplied for foreach() in zen_preprocess_menu_link() (line 642 of /var/www//sites/all/themes/zen/template.php).
Warning: array_unshift() expects parameter 1 to be array, string given in zen_preprocess_menu_link() (line 651 of /var/www//sites/all/themes/zen/template.php).
I thought it was my module or subtheme, but after disabling both on my site it is still throwing warnings. It appears there is a link somewhere in Zen (or in Drupal core or a contrib module?) that is passing a class to localized options as a string instead of an array.
Comment | File | Size | Author |
---|---|---|---|
#5 | zen-fix-php-notices-with-menu-2058221-5.patch | 739 bytes | blakehall |
Comments
Comment #1
Jedd Casella CreditAttribution: Jedd Casella commented-
Comment #2
JohnAlbin$variables['element']['#localized_options']['attributes']['class'] is supposed to be an array, isn't it? That's the way its treated in the menu_block.module. Hmmm…
Comment #3
mermemladeK CreditAttribution: mermemladeK commentedIt seems I have similar problem
https://drupal.org/node/2088109
Comment #4
mermemladeK CreditAttribution: mermemladeK commentedI "solved" my PHP errors by downgrading from 7.x-5.4 to 7.x-5.1. Versions 7.x-5.x-dev and 7.x-5.2 did not do the trick for me.
I hope this helps patpluspun and the zen mantainers as well.
Comment #5
blakehall CreditAttribution: blakehall commentedI'm not sure if this is the _best_ way to solve the issue, but here's a fix.
We've been seeing this error for quite a while on a multilingual multisite.
Comment #6
Christopher James Francis Rodgers CreditAttribution: Christopher James Francis Rodgers commentedI am curious if this is still an issue with Zen 7.x-5.4
since it has been substantially updated
from the train-wreck that 5.3 was... ?
Please respond, so that, if it is not a problem w/ 5.4,
this issue can be closed with the status: "Closed (Won't Fix)"
Thank you for you time, attention, and help.
Comment #7
miogus CreditAttribution: miogus commentedYes, it is still an issue with Zen 7.x-5.4
The php warning messages are :
Warning: array_unshift() expects parameter 1 to be array, string given in zen_preprocess_menu_link() (line 637 of XXX/sites/all/themes/zen/template.php).
and
Warning: Invalid argument supplied for foreach() in zen_preprocess_menu_link() (line 621 of XXX/sites/all/themes/zen/template.php).
I hope this could help
Comment #8
JohnAlbin$variables['element']['#localized_options']['attributes']['class'] is supposed to be an array. Something else in your system is treating it as a string. However, looking at the docs, there's nothing that says it is supposed to be an array.
So I guess, I need to account for strings. *sigh*
Comment #9
chaps2 CreditAttribution: chaps2 commentedI got this after adding a single class to a menu item (classes field of menu item edit form). As a work around I added another dummy class.
Comment #12
JohnAlbinFixed!