Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorMatthieu Napoli <matthieu@mnapoli.fr>2014-10-22 05:49:29 +0400
committerMatthieu Napoli <matthieu@mnapoli.fr>2014-10-22 05:50:23 +0400
commitad2c051089281bbfa39b9426e1009a7a2fb9d08d (patch)
tree9a23e3bb3d167c86884f26a13584e4e43da7fb53 /core
parentef4e84f20e59649a05240118de5ecedb56fd6996 (diff)
#6491 Fixes a redirection loop when Nginx is misconfigured and passes an incorrect PATH_INFO
Diffstat (limited to 'core')
-rw-r--r--core/Url.php29
1 files changed, 5 insertions, 24 deletions
diff --git a/core/Url.php b/core/Url.php
index c27805305d..1d34c17ca3 100644
--- a/core/Url.php
+++ b/core/Url.php
@@ -66,8 +66,7 @@ class Url
{
return self::getCurrentScheme() . '://'
. self::getCurrentHost()
- . self::getCurrentScriptName()
- . self::getCurrentPathInfo()
+ . self::getCurrentScriptName(false)
. self::getCurrentQueryString();
}
@@ -84,8 +83,7 @@ class Url
{
return self::getCurrentScheme() . '://'
. self::getCurrentHost($default = 'unknown', $checkTrustedHost)
- . self::getCurrentScriptName()
- . self::getCurrentPathInfo();
+ . self::getCurrentScriptName(false);
}
/**
@@ -127,11 +125,12 @@ class Url
/**
* Returns the path to the script being executed. Includes the script file name.
*
+ * @param bool $removePathInfo If true (default value) then the PATH_INFO will be stripped.
* @return string eg, `"/dir1/dir2/index.php"` if the current URL is
* `"http://example.org/dir1/dir2/index.php?param1=value1&param2=value2"`
* @api
*/
- public static function getCurrentScriptName()
+ public static function getCurrentScriptName($removePathInfo = true)
{
$url = '';
@@ -149,7 +148,7 @@ class Url
}
// strip path_info
- if (isset($_SERVER['PATH_INFO'])) {
+ if ($removePathInfo && isset($_SERVER['PATH_INFO'])) {
$url = substr($url, 0, -strlen($_SERVER['PATH_INFO']));
}
}
@@ -176,24 +175,6 @@ class Url
}
/**
- * Returns the current PATH_INFO from the request.
- *
- * Contains any client-provided pathname information trailing the actual
- * script filename but preceding the query string, if available.
- *
- * For instance, if the current script was accessed via the URL
- * http://www.example.com/php/path_info.php/some/stuff?foo=bar
- * then getCurrentPathInfo() would return "/some/stuff".
- *
- * @return string
- * @api
- */
- public static function getCurrentPathInfo()
- {
- return isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '';
- }
-
- /**
* Returns the current URL's protocol.
*
* @return string `'https'` or `'http'`