TIP: Use Markdown or, <pre> for multi line code blocks / <code> for inline code.
These forums are read-only and for archival purposes only!
Please join our new forums at discourse.kohanaframework.org
Missing argument 2 for Controller_Class
  • I'm trying to use a link with 2 arguments like:


    When I visite the page I get ErrorException [ Warning ]: Missing argument 2 for Controller_User::action_activate()

    My route entry is :

    Route::set('default', '((/(/)))', array('id' => '.+'))
    'controller' => 'welcome',
    'action' => 'index',

    And the controller class is:

    <?php defined('SYSPATH') or die('No direct script access.');<br />
    class Controller_User extends Controller_DefaultTemplate {

    public function action_activate($userid, $arg2)
    $this->template->content = $userid;

    What can be wrong?

  • Your controller is expecting a 2nd parameter ($arg2) to be passed to it, however there isn't a second, custom parameter defined in the route.

    You'd be best accessing the parameters through


  • Aha... Can you explain to me what does array('id' => '.+') do? How should I put 2 arguments in the route?

    And why is it better to access the parameters using $this->request->param('id') ?

    Is there any tutorial/guide I could read for more info on these?
  • Tuts about routes can be found at the docs - http://kohanaframework.org/guide/tutorials.urls

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion