summaryrefslogtreecommitdiff
path: root/includes/language.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/language.inc')
-rw-r--r--includes/language.inc5
1 files changed, 4 insertions, 1 deletions
diff --git a/includes/language.inc b/includes/language.inc
index a9c84eb2c..b5c56f7d7 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];
}