diff options
author | Derek Jones <derek.jones@ellislab.com> | 2009-02-10 19:15:14 +0100 |
---|---|---|
committer | Derek Jones <derek.jones@ellislab.com> | 2009-02-10 19:15:14 +0100 |
commit | 5f386a3c791fdb97bd403c4469b79578ae0af702 (patch) | |
tree | 55f9a7a97dd9f8fb4df08e6ac3263dffb388555d | |
parent | a6aabaff9a396436d36b57df84eec77ee72e70ed (diff) |
fixed bug with routed URI segments when the default controller was accessed without the controller name in the URL
http://codeigniter.com/bug_tracker/bug/6517/
-rw-r--r-- | system/libraries/Router.php | 26 | ||||
-rw-r--r-- | user_guide/changelog.html | 1 |
2 files changed, 16 insertions, 11 deletions
diff --git a/system/libraries/Router.php b/system/libraries/Router.php index 32de58dbf..bc46da4e1 100644 --- a/system/libraries/Router.php +++ b/system/libraries/Router.php @@ -97,18 +97,22 @@ class CI_Router { { show_error("Unable to determine what should be displayed. A default route has not been specified in the routing file."); } + + if (strpos($this->default_controller, '/') !== FALSE) + { + $x = explode('/', $this->default_controller); - // Turn the default route into an array. We explode it in the event that - // the controller is located in a subfolder - $segments = $this->_validate_request(explode('/', $this->default_controller)); + $this->set_class(end($x)); + $this->set_method('index'); + $this->_set_request($x); + } + else + { + $this->set_class($this->default_controller); + $this->set_method('index'); + $this->_set_request(array($this->default_controller, 'index')); + } - // Set the class and method - $this->set_class($segments[0]); - $this->set_method('index'); - - // Assign the segments to the URI class - $this->uri->rsegments = $segments; - // re-index the routed segments array so it starts with 1 rather than 0 $this->uri->_reindex_segments(); @@ -144,7 +148,7 @@ class CI_Router { * @return void */ function _set_request($segments = array()) - { + { $segments = $this->_validate_request($segments); if (count($segments) == 0) diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 733bfc000..504d2b4bb 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -125,6 +125,7 @@ SVN Revision: </p> <li>Fixed a bug in the Text Helper affecting some locales where word_censor() would not work on words beginning or ending with an accented character.</li> <li>Fixed a bug in the Text Helper character limiter where the provided limit intersects the last word of the string.</li> <li>Fixed a bug (#6342) with plural() in the Inflection helper with words ending in "y".</li> + <li>Fixed bug (#6517) where Routed URI segments returned by URI::rsegment() method were incorrect for the default controller.</li> <li>Tweaked Typography::auto_typography() for some edge-cases.</li> </ul> |