After installing Menus, in administrators view only, a PHP warning showed in locale.module, line 343. Message was "warning: Wrong datatype for first argument in call to array_key_exists in /usr/local/httpd/htdocs/drupal/modules/locale.module on line 343"

This has been traced to locale() function of the locale.module.
For fix, replace locale() function with version attached below:

function locale($string) {
  global $locale;
  static $locale_t;

  if (!isset($locale_t)) {
    $cache = cache_get("locale:$locale");

    if ($cache == 0) {
      locale_refresh_cache();
      $cache = cache_get("locale:$locale");
    }
    $locale_t = unserialize($cache->data);
  }

  $result = false;
  if (!empty($string)) $result = array_key_exists($string, $locale_t);
  if (is_array($locale_t) && ($result)) {
    $string = $locale_t[$string];
  }
  else {
    $result = db_query("SELECT lid, $locale FROM {locales} WHERE string = '%s'", $string);
    if (!db_fetch_object($result)) {
      db_query("INSERT INTO {locales} (string, location) VALUES ('%s', '%s')", $string, re      cache_clear_all("locale:$locale");
    }
  } 
  
  return $string;
} 

Please consider revising menus.module code.
Although the fix was in the locale.module code, I believe that menus.module is responsble since I haven't encountered any similar side-effects with other modules I have installed

Comments

Anonymous’s picture

It's pretty easy to fix in the menus.module
Insert a $theOutput = ''; at the top of the menus_help() function.
Now why this will fix it I guess is another story.

killes@www.drop.org’s picture

Project: » Locale
Assigned: Unassigned » killes@www.drop.org

This is fixed in cvs.

Anonymous’s picture