If using memcache + "i18n - menu" script dies with:
[09-Apr-2008 21:53:16] PHP Fatal error: Cannot use string offset as an array in /var/www/vhosts/www.destiny.lv/www/includes/menu.inc on line 1229

which corresponds to
// Menu items not in the DB get temporary negative IDs.
$temp_mid = min(array_keys($_menu['items'])) - 1;
$new_items = array();

foreach ($menu_item_list as $item) {
if (isset($item['callback'])) {
>>> $_menu['callbacks'][$item['path']] = array('callback' => $item['callback']);
if (isset($item['callback arguments'])) {

Comments

firebus’s picture

Category: bug » support

is it that case that i18n menu does it's own caching?

if so, have you removed calls to serialize and unserialize

memcache handles serialization internally - if you look at the memcache patches, you'll see that the bulk of what they do is to remove calls to serialize and unserialize from core caching code. you'll need to do the same with any contrib module you use that caches

ghostks’s picture

I've searched for the serialize/unserialize code in i18n, menu.inc and removed all instances but anyway the problem exists. I will try to investigate more and will notify if I'll find anything. The most interesting thing only i18n.menu sub module is broken, all others i18n.* are working perfectly.

snufkin’s picture

same problem, with i18n here too.

robertDouglass’s picture

Does the problem exist after removing serialize/unserialize AND clearing the caches (memcache and db)?

robertDouglass’s picture

Also try with a memcache version greater than 1.7 (ie DRUPAL-5) because I think a patch that went in might solve this but need confirmation.

robertDouglass’s picture

Priority: Critical » Normal
pcambra’s picture

I am getting this error too in a multisite installation.

One of the sites, which has not i18n module installed, got the error, but it went away after running update.php.
The other site gets the error even after the update.php, if i clear the cache tables, the site runs good once, but the next time i get the error:

Fatal error: Cannot use string offset as an array in menu.inc on line 1229

Anyone can help me? (using drupal 5.10)

Thanks

mikhailian’s picture

Version: 5.x-1.7 » 5.x-1.8

Got exactly the same problem, i18n-menu, 5.10,
Fatal error: Cannot use string offset as an array in menu.inc on line 1229
This configuration seems to be very popular ;-)

And it does not help changing in i18nmenu.module
cache_set($cid, 'cache_menu', serialize($_menu), time() + (60 * 60 * 24));
into
cache_set($cid, 'cache_menu', $_menu, time() + (60 * 60 * 24));
I still get the same error on line 1229

mikhailian’s picture

Does the problem exist after removing serialize/unserialize AND clearing the caches (memcache and db)?

Gosh! Forgot to restart memcached!!!

The problem is solved with this simple patch to i18nmenu.module:

--- sites/all/modules/i18n/contrib/i18nmenu.module.orig 2008-09-19 00:03:48.000000000 +0200
+++ sites/all/modules/i18n/contrib/i18nmenu.module      2008-09-19 00:18:14.000000000 +0200
@@ -34,7 +34,7 @@
     }
   }
   // Update cache
-  cache_set($cid, 'cache_menu', serialize($_menu), time() + (60 * 60 * 24));
+  cache_set($cid, 'cache_menu', $_menu, time() + (60 * 60 * 24));
 }
 
 function i18nmenu_help($section = 'admin/help#i18nmenu' ) {
snufkin’s picture

I haven't been able to reproduce the error with 5.x-1.8 so far.

catch’s picture

Status: Active » Closed (cannot reproduce)

That's a bug with i18n_menu.