Skip to content

Commit

Permalink
Revert "Controllers and actions with hyphens should be converted to u…
Browse files Browse the repository at this point in the history
…nderscores, fixes #1942"

This reverts commit a3020e2.
  • Loading branch information
Woody Gilk committed Aug 20, 2009
1 parent 866603d commit 3f6919b
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions classes/kohana/request.php
Expand Up @@ -821,11 +821,8 @@ 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.$controller);
$class = new ReflectionClass($prefix.$this->controller);

if ($class->isAbstract())
{
Expand All @@ -842,9 +839,6 @@ 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

4 comments on commit 3f6919b

@evgenius
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have you reverted this commit? I miss this code very much! Could you tell me how can I replace hyphens with underscores not touching kohana core?

@evgenius
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found the solution. These lines should be used in bootstrap.php:

$request = Request::instance();
// Replace hyphens with underscores. Use hyphens for actions in URL to avoid ugly URLs
$request->action = str_replace('-', '_', $request->action);
echo $request->execute()
    ->send_headers()
    ->response;

@shadowhand
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the comments on the issue: http://dev.kohanaframework.org/issues/1942

@banks
Copy link

@banks banks commented on 3f6919b Mar 31, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@evgenius: you should fix this by extending Request, not hacking bootstrap.

Please sign in to comment.