Closed (fixed)
Project:
Locale
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Anonymous (not verified)
Created:
7 Nov 2003 at 19:17 UTC
Updated:
22 Mar 2004 at 00:20 UTC
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
Comment #1
(not verified) commentedIt'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.
Comment #2
killes@www.drop.org commentedThis is fixed in cvs.
Comment #3
(not verified) commented