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

trungonly’s picture

Version: 6.x-2.x-dev » 6.x-1.x-dev

This is for the latest 6.x-1.x-dev.

AlexisWilke’s picture

Any particular reasons why it would become an array? Could it be for users who have more than one language listed in their browser?