Skip to content

Commit

Permalink
Controllers and actions with hyphens should be converted to underscor…
Browse files Browse the repository at this point in the history
…es, fixes #1942
  • Loading branch information
Woody Gilk committed Aug 15, 2009
1 parent 2a87f03 commit a3020e2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion classes/kohana/request.php
Expand Up @@ -821,8 +821,11 @@ public function execute()

try
{
// Replace hyphens with underscores in the controller name
$controller = str_replace('-', '_', $this->controller);

// Load the controller using reflection
$class = new ReflectionClass($prefix.$this->controller);
$class = new ReflectionClass($prefix.$controller);

// Create a new instance of the controller
$controller = $class->newInstance($this);
Expand All @@ -833,6 +836,9 @@ public function execute()
// Determine the action to use
$action = empty($this->action) ? Route::$default_action : $this->action;

// Replace hyphens with underscores in the action name
$action = str_replace('-', '_', $action);

// Execute the main action with the parameters
$class->getMethod('action_'.$action)->invokeArgs($controller, $this->_params);

Expand Down

0 comments on commit a3020e2

Please sign in to comment.