diff --git a/includes/language.inc b/includes/language.inc index a9c84eb2c80202900896654d09dca2dd90a7cec1..b5c56f7d76b0688a36162efecd0cf6fb745dad81 100644 --- a/includes/language.inc +++ b/includes/language.inc @@ -30,9 +30,12 @@ function language_initialize() { case LANGUAGE_NEGOTIATION_PATH_DEFAULT: case LANGUAGE_NEGOTIATION_PATH: $languages = language_list('prefix'); - $args = explode('/', $_GET['q']); + // $_GET['q'] might not be available at this time, because + // path initialization runs after the language bootstrap phase. + $args = isset($_GET['q']) ? explode('/', $_GET['q']) : array(); $language = array_shift($args); if (isset($languages[$language])) { + // Rebuild $GET['q'] with the language removed. $_GET['q'] = implode('/', $args); return $languages[$language]; }