summaryrefslogtreecommitdiffstats
path: root/system/libraries/Router.php
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2009-02-10 19:15:14 +0100
committerDerek Jones <derek.jones@ellislab.com>2009-02-10 19:15:14 +0100
commit5f386a3c791fdb97bd403c4469b79578ae0af702 (patch)
tree55f9a7a97dd9f8fb4df08e6ac3263dffb388555d /system/libraries/Router.php
parenta6aabaff9a396436d36b57df84eec77ee72e70ed (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/
Diffstat (limited to 'system/libraries/Router.php')
-rw-r--r--system/libraries/Router.php26
1 files changed, 15 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)