diff --git a/src/Http/RequestFactory.php b/src/Http/RequestFactory.php index 6ada3696..32220b1b 100644 --- a/src/Http/RequestFactory.php +++ b/src/Http/RequestFactory.php @@ -113,16 +113,16 @@ public function createHttpRequest() $script = '/'; } - $path = strtolower($url->getPath()) . '/'; - $script = strtolower($script) . '/'; - $max = min(strlen($path), strlen($script)); - for ($i = 0; $i < $max; $i++) { - if ($path[$i] !== $script[$i]) { + $path = $url->getPath(); + $max = min(strlen($path), strlen($script)) - 1; + for ($i = 0, $j = 0; $i <= $max; $i++) { + if ($path[$i] !== $script[$i] && strcasecmp($path[$i], $script[$i])) { break; - } elseif ($path[$i] === '/') { - $url->setScriptPath(substr($url->getPath(), 0, $i + 1)); + } elseif ($path[$i] === '/' || $i === $max) { + $j = $i; } } + $url->setScriptPath(substr($path, 0, $j + 1)); // GET, POST, COOKIE $useFilter = (!in_array(ini_get('filter.default'), array('', 'unsafe_raw')) || ini_get('filter.default_flags'));