After upgrading a dev site to PHP 5.4, I get the following error when clearing the menu cache.

Warning: Illegal string offset '#href' in admin_menu_admin_menu_output_alter() (line 524 of admin_menu.module).

Line 524 is:
if ($link['#href'] == 'admin/tasks' || $link['#href'] == 'admin/index') {

In this case $link is not always an array. PHP 5.3 ignored this, but it is now a warning in 5.4.

Comments

davisben’s picture

Status: Active » Needs review
StatusFileSize
new1.04 KB

Here's a patch to check if $link is an array.

Status: Needs review » Needs work

The last submitted patch, admin-menu-illegal-offset-1472236-1.patch, failed testing.

davisben’s picture

Status: Needs work » Needs review
StatusFileSize
new752 bytes

Try again.

sun’s picture

StatusFileSize
new595 bytes

Can you try this instead?

sun’s picture

Status: Needs review » Fixed

Thanks for reporting, reviewing, and testing! Committed to all branches.

A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.

davisben’s picture

Works, thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.