summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2015-08-05 11:26:22 +0200
committerAndrey Andreev <narf@devilix.net>2015-08-05 11:26:22 +0200
commitabc299b3a234eb7da1b7e3d257b7eba2da649219 (patch)
tree4a0136703384524722d07d5f085df9eb9f1e531f
parent6cefc6bb25c4a30cd86515a831ce0ac82cc43073 (diff)
Fix #4027
-rw-r--r--system/core/Router.php20
-rw-r--r--user_guide_src/source/changelog.rst1
2 files changed, 13 insertions, 8 deletions
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];
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 4e8f2f775..1b044cc5f 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -76,6 +76,7 @@ Bug fixes for 3.0.1
- Fixed a bug in :doc:`Query Builder <database/query_builder>` where the ``$escape`` parameter for some methods only affected field names.
- Fixed a bug (#4012) - :doc:`Query Builder <database/query_builder>` methods ``where_in()``, ``or_where_in()``, ``where_not_in()``, ``or_where_not_in()`` didn't take into account previously cached WHERE conditions when query cache is in use.
- Fixed a bug (#4015) - :doc:`Email Library <libraries/email>` method ``set_header()`` didn't support method chaining, although it was advertised.
+- Fixed a bug (#4027) - :doc:`Routing <general/routing>` with HTTP verbs only worked if the route request method was declared in all-lowercase letters.
Version 3.0.0
=============