From 500b9d3af54b6c4d221bf148206307988abc4420 Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Sat, 19 Jan 2008 17:12:31 +0000 Subject: Fixed bug #3268 where router could leave '/' as the path --- system/libraries/URI.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'system') diff --git a/system/libraries/URI.php b/system/libraries/URI.php index 139b52b5d..5aafbb4cd 100644 --- a/system/libraries/URI.php +++ b/system/libraries/URI.php @@ -78,7 +78,7 @@ class CI_URI { // Is there a PATH_INFO variable? // Note: some servers seem to have trouble with getenv() so we'll test it two ways $path = (isset($_SERVER['PATH_INFO'])) ? $_SERVER['PATH_INFO'] : @getenv('PATH_INFO'); - if ($path != '' AND $path != "/".SELF) + if ($path != '' AND $path != '/' AND $path != "/".SELF) { $this->uri_string = $path; return; @@ -86,7 +86,7 @@ class CI_URI { // No PATH_INFO?... What about QUERY_STRING? $path = (isset($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : @getenv('QUERY_STRING'); - if ($path != '') + if ($path != '' AND $path != '/') { $this->uri_string = $path; return; @@ -94,7 +94,7 @@ class CI_URI { // No QUERY_STRING?... Maybe the ORIG_PATH_INFO variable exists? $path = (isset($_SERVER['ORIG_PATH_INFO'])) ? $_SERVER['ORIG_PATH_INFO'] : @getenv('ORIG_PATH_INFO'); - if ($path != '' AND $path != "/".SELF) + if ($path != '' AND $path != '/' AND $path != "/".SELF) { $this->uri_string = $path; return; @@ -187,14 +187,15 @@ class CI_URI { */ function _filter_uri($str) { - if ($this->config->item('permitted_uri_chars') != '') + if ($str != '' AND $this->config->item('permitted_uri_chars') != '') { if ( ! preg_match("|^[".preg_quote($this->config->item('permitted_uri_chars'))."]+$|i", $str)) { exit('The URI you submitted has disallowed characters.'); } - } - return $str; + } + + return $str; } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b