From abc299b3a234eb7da1b7e3d257b7eba2da649219 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 5 Aug 2015 12:26:22 +0300 Subject: Fix #4027 --- system/core/Router.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'system') diff --git a/system/core/Router.php b/system/core/Router.php index ab5246a1f..0c793e418 100644 --- a/system/core/Router.php +++ b/system/core/Router.php @@ -375,16 +375,19 @@ class CI_Router { // Is there a literal match? If so we're done if (isset($this->routes[$uri])) { - // Check default routes format - if (is_string($this->routes[$uri])) + // Is it an HTTP verb-based route? + if (is_array($this->routes[$uri])) { - $this->_set_request(explode('/', $this->routes[$uri])); - return; + $route = array_change_key_case($this->routes[$uri], CASE_LOWER); + if (isset($route[$http_verb])) + { + $this->_set_request(explode('/', $route[$http_verb])); + return; + } } - // Is there a matching http verb? - elseif (is_array($this->routes[$uri]) && isset($this->routes[$uri][$http_verb])) + else { - $this->_set_request(explode('/', $this->routes[$uri][$http_verb])); + $this->_set_request(explode('/', $this->routes[$uri])); return; } } @@ -392,9 +395,10 @@ class CI_Router { // Loop through the route array looking for wildcards foreach ($this->routes as $key => $val) { - // Check if route format is using http verb + // Check if route format is using HTTP verbs if (is_array($val)) { + $val = array_change_key_case($val, CASE_LOWER); if (isset($val[$http_verb])) { $val = $val[$http_verb]; -- cgit v1.2.3-24-g4f1b