summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-10-11 02:14:43 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-10-11 02:14:43 +0000
commit64a1a0d67eb5aecc8e6d78469b19f58e8443c717 (patch)
tree895efeb6e8c328b80ad48cce515a9004f434f18e /includes
parent704e3ef81219d55950505f1efb7dda33e1fcc431 (diff)
downloadbrdo-64a1a0d67eb5aecc8e6d78469b19f58e8443c717.tar.gz
brdo-64a1a0d67eb5aecc8e6d78469b19f58e8443c717.tar.bz2
#600554 by sun: Fixed drupal_parse_url() to work with clean URLs disabled (with tests).
Diffstat (limited to 'includes')
-rw-r--r--includes/common.inc13
1 files changed, 12 insertions, 1 deletions
diff --git a/includes/common.inc b/includes/common.inc
index d8661100c..c264147e9 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -486,7 +486,11 @@ function drupal_get_destination() {
}
/**
- * Wrapper around parse_url() to parse a given URL into an associative array, suitable for url().
+ * Wrapper around parse_url() to parse a system URL string into an associative array, suitable for url().
+ *
+ * This function should only be used for URLs that have been generated by the
+ * system, resp. url(). It should not be used for URLs that come from external
+ * sources, or URLs that link to external resources.
*
* The returned array contains a 'path' that may be passed separately to url().
* For example:
@@ -552,6 +556,13 @@ function drupal_parse_url($url) {
$options['fragment'] = $parts['fragment'];
}
}
+ // The 'q' parameter contains the path of the current page if clean URLs are
+ // disabled. It overrides the 'path' of the URL when present, even if clean
+ // URLs are enabled, due to how Apache rewriting rules work.
+ if (isset($options['query']['q'])) {
+ $options['path'] = $options['query']['q'];
+ unset($options['query']['q']);
+ }
return $options;
}