summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2006-12-08 11:55:56 +0000
committerDries Buytaert <dries@buytaert.net>2006-12-08 11:55:56 +0000
commitea7224fb6a2909048bf5cb459fe0d292060a93ae (patch)
tree5ca508b977238b72ec4a0ad540828baabc3e6d00
parent8c020c0774dced0cf91d1aa954421c55ef502fac (diff)
downloadbrdo-ea7224fb6a2909048bf5cb459fe0d292060a93ae.tar.gz
brdo-ea7224fb6a2909048bf5cb459fe0d292060a93ae.tar.bz2
- Patch #87310 by dfaulkner and Grugnog2: fix borken request_uri() on some systems.
-rw-r--r--includes/bootstrap.inc30
1 files changed, 20 insertions, 10 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index cb4ec13b5..04befd32a 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -515,20 +515,30 @@ function check_plain($text) {
}
/**
- * Since $_SERVER['REQUEST_URI'] is only available on Apache, we
- * generate an equivalent using other environment variables.
+ * The value of $_SERVER['REQUEST_URI'] is inconsistent between various
+ * web servers (Apache, IIS, iPlanet, etc.).
+ *
+ * For those cases where REQUEST_URI is provided, we inspect it to be sure
+ * that it contains the QUERY_STRING as well as the actual REQUEST_URI.
+ *
+ * Where this value is not available we generate an equivalent using other
+ * environment variables.
*/
function request_uri() {
-
- if (isset($_SERVER['REQUEST_URI'])) {
- $uri = $_SERVER['REQUEST_URI'];
- }
- else {
- if (isset($_SERVER['argv'])) {
- $uri = $_SERVER['PHP_SELF'] .'?'. $_SERVER['argv'][0];
+ static $uri;
+ if (!isset($uri)) {
+ // If we have a REQUEST_URI and the query string is present in it, we use the value directly.
+ if (isset($_SERVER['REQUEST_URI']) && !empty($_SERVER['QUERY_STRING']) && strpos($_SERVER['REQUEST_URI'], $_SERVER['QUERY_STRING'])) {
+ $uri = $_SERVER['REQUEST_URI'];
}
else {
- $uri = $_SERVER['PHP_SELF'] .'?'. $_SERVER['QUERY_STRING'];
+ // Generate an equivalent.
+ if (isset($_SERVER['argv'])) {
+ $uri = $_SERVER['PHP_SELF'] .'?'. $_SERVER['argv'][0];
+ }
+ else {
+ $uri = $_SERVER['PHP_SELF'] .'?'. $_SERVER['QUERY_STRING'];
+ }
}
}