Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Router.php: Fix validate_route() for default controller in subfolder

When the URL would only contain the subfolder but not the controller
name, the used routine was wrong.
  • Loading branch information...
commit 0f3d6d1632af0479105f75dc3e6d1fdd8178102e 1 parent f3b2410
@tomcode authored
Showing with 10 additions and 3 deletions.
  1. +10 −3 system/core/Router.php
View
13 system/core/Router.php
@@ -273,9 +273,14 @@ public function validate_route($route)
continue;
}
- // Get class and method
- $class = array_unshift($default);
- $method = array_unshift($default);
+ // Get class and method:
+ // - index 0 and 1 are always present
+ // - since we are in a sub-folder the
+ // first entry is now the directory
+ $directory = array_shift($default);
+ $class = array_shift($default);
+ // the $default route may not have the method set
+ $method = count($default) ? array_shift($default) : 'index';
}
// Does the requested controller exist in the sub-folder?
@@ -534,6 +539,8 @@ public function _set_overrides($routing)
/**
* Get segments of default controller
*
+ * Returns at least two segments
+ *
* @access protected
* @return array array of segments
*/
Please sign in to comment.
Something went wrong with that request. Please try again.