diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-03-10 19:36:14 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-03-10 19:36:14 +0000 |
commit | 632ae14d9cd4ed60c6fe365ca15f1d3904bc165b (patch) | |
tree | b33115088a2ca1c98111f4ef4082e720b91cba54 | |
parent | b00ab9d17a212dae43d43607e0cc2c76ef78b645 (diff) | |
download | brdo-632ae14d9cd4ed60c6fe365ca15f1d3904bc165b.tar.gz brdo-632ae14d9cd4ed60c6fe365ca15f1d3904bc165b.tar.bz2 |
#587706 follow-up by plach: trim GET['q'] centrally in request_path() so subsequent places don't have to do it.
-rw-r--r-- | includes/bootstrap.inc | 5 | ||||
-rw-r--r-- | includes/language.inc | 2 | ||||
-rw-r--r-- | includes/path.inc | 2 |
3 files changed, 7 insertions, 2 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index 5dd22249d..a5b2d1afd 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -2188,6 +2188,11 @@ function request_path() { $path = ''; } + // Under certain conditions Apache's RewriteRule directive prepends the value + // assigned to $_GET['q'] with a slash. Moreover we can always have a trailing + // slash in place, hence we need to normalize $_GET['q']. + $path = trim($path, '/'); + return $path; } diff --git a/includes/language.inc b/includes/language.inc index 608ed112e..43a4961a0 100644 --- a/includes/language.inc +++ b/includes/language.inc @@ -359,7 +359,7 @@ function language_from_default() { * - The path without the prefix on success, the given path otherwise. */ function language_url_split_prefix($path, $languages) { - $args = empty($path) ? array() : explode('/', trim($path, '/')); + $args = empty($path) ? array() : explode('/', $path); $prefix = array_shift($args); // Search prefix within enabled languages. diff --git a/includes/path.inc b/includes/path.inc index 240f375f0..9e38d1171 100644 --- a/includes/path.inc +++ b/includes/path.inc @@ -15,7 +15,7 @@ */ function drupal_path_initialize() { if (!empty($_GET['q'])) { - $_GET['q'] = drupal_get_normal_path(trim($_GET['q'], '/')); + $_GET['q'] = drupal_get_normal_path($_GET['q']); } else { $_GET['q'] = drupal_get_normal_path(variable_get('site_frontpage', 'node')); |