From 0db0dadef71b2c0155f491cba5723bcb090e4efa Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 15 Jun 2011 06:24:58 -0700 Subject: [PATCH] Improve request URI determination. --- system/request.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/system/request.php b/system/request.php index 671de97b..dd3be314 100644 --- a/system/request.php +++ b/system/request.php @@ -36,7 +36,12 @@ public static function uri() // ------------------------------------------------------- elseif (isset($_SERVER['REQUEST_URI'])) { - $uri = str_replace('/index.php', '', $_SERVER['REQUEST_URI']); + $uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); + + if ($uri === false) + { + throw new \Exception("Malformed request URI. Request terminated."); + } } // ------------------------------------------------------- // Neither PATH_INFO or REQUEST_URI are available.