Active
Project:
Addresses
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
25 Jul 2011 at 07:28 UTC
Updated:
25 Jul 2011 at 10:28 UTC
I sometimes get this warning error:
warning: Illegal offset type in isset or empty in \modules\addresses\addresses.settings.inc on line 293.
This is because of (sometimes) the $_GET['language'] is not usually a string ("en"), but an array like this:
(Array, 2 elements)
0 (String, 2 characters ) en
1 (String, 2 characters ) en
So you should check for if it is an array or not.
My fix:
Original:
// Keep the same language between calls so that t() calls work as expected
if (!empty($_GET['language'])) {
$languages = language_list(); // get all languages
if (isset($languages[$_GET['language']])) {
$language = $languages[$_GET['language']];
}
}
Replaced by:
// Keep the same language between calls so that t() calls work as expected
if (!empty($_GET['language'])) {
$languages = language_list(); // get all languages
$GET_language = is_array($_GET['language']) ? $_GET['language'][0] : $_GET['language'];
if (isset($languages[$GET_language])) {
$language = $languages[$GET_language];
}
}
Comments
Comment #1
trungonly commentedThis is for the latest 6.x-1.x-dev.
Comment #2
AlexisWilke commentedAny particular reasons why it would become an array? Could it be for users who have more than one language listed in their browser?