Illegal offset type errors (in D5.5)

incrn8 - December 16, 2007 - 23:49
Project:Quick Admin Menus
Version:5.x-1.0-beta2
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Odd problem I got when using beta2 on Drupal 5.5 - every page showed an Illegal offset type error (actually 3 of them) at lines 162, 164 and 170. An error in menu.inc at line 280 also appeared for some reason. The offset type errors in the module are due to the use of [$mid]. The really odd thing is that in Drupal 5.3, it worked fine. If I wrap each $mid like so: '$mid', the errors go away, except for the menu.inc error, which is always there.

Everything still works fine - moving menus, renaming, etc. So its obviously not serious. Its not really a module I'd keep on a live site, so I can live with the errors during setup, but it would be nice to have no errors :)

This is an awesome module and something like this really needs to be in core. Great work!

#1

starbow - December 17, 2007 - 18:31
Title:Illegal offset type errors» Illegal offset type errors (in D5.5)

#2

jandoemen - January 5, 2008 - 12:42

+1 exactly the same errors. Please fix.
Thanks for the great module.

#3

davedelong - February 1, 2008 - 05:13

I'm not sure if this is the best place to put this comment, but I had a similar error when developing a custom theme and overriding the theme_menu_item_link() function. I kept on getting "Illegal offset type" warnings for menu.inc, line 280.

I tried the suggestion above to put the "$mid" variable in quote marks, and that, for whatever reason, caused them to go away. I still have no idea what it all meant. =)

#4

Viybel - March 18, 2008 - 15:29

Apparently, the $menu array needs $mid to be a string to be used as a key.

Just add:

$mid = strval($mid);

below line 160:

function qam_admin_menu( $mid ) {

and all errors will be gone.

#5

starbow - July 21, 2009 - 21:20
Status:active» closed
 
 

Drupal is a registered trademark of Dries Buytaert.