Kirby Routing Problem

Maybe I did not understand kirby routing!

if I use this code

c::set('routes', array(
    'pattern' => 'reset/(:any)/(:any)',
    'action'  => function($username,$resetcode) {      

        return page('reset');


when I try to get to the url ‘reset/some/value’ of the site I get this error message

Fatal error: Call to a member function code() on a non-object in /web/htdocs/kirby/kirby.php on line 412

obviously ‘reset’ is a real first level page!

same message is returned if I use

return array('reset', $data);


  return response::json(array(
    'some', 'json', 'stuff'

No problem with:

return go('some/page');

If I remove c::set('languages' ...etc from config.php (meanwhile, there seems to be a problem of localization function) I have no errors but if I use at the end of router action function

return page('reset')


return array('reset', $data);

i get a blank page!!!

@bastianallgeier it’s a bug or I did not understand kirby routing??!!

thanks in advance!

The following works for me:

return $site->visit('reset');

I’m currently not able to test your code snippets. Will do that later.

Your code suggestion get this error

Fatal error: Call to a member function visit() on a non-object in 
/web/htdocs/site/config/config.php on line 133

because $site is not an active object instance in routing action function.

I used the same code in Routing Actions Docs Example and specifically should I use

Returning a page with additional data for the template

function() {

  // additional data for the page
  $data = array(
    'foo' => 'bar'

  return array('some/page', $data);

because I need to show the page passing variables internally

@bastianallgeier or someone else can help me understand kirby routing in this specific case?

thanks in advance

With regards to this specific issue, using site() instead of $site works for me.

thank you @samnabi !