Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]Routing parsing with multi-lingual #1804

Closed
nghenglim opened this issue Jan 13, 2014 · 2 comments
Closed

[BUG]Routing parsing with multi-lingual #1804

nghenglim opened this issue Jan 13, 2014 · 2 comments

Comments

@nghenglim
Copy link

According to vokuro syntax, if I do http://localhost/vokuro/zh/reset-password/somecode/3

<?php

$router = new Phalcon\Mvc\Router();
$router->add('/confirm/{code}/{uid}', array(
    'controller' => 'user_control',
    'action' => 'confirmEmail'
));
$router->add('/reset-password/{code}/{uid}', array(
    'controller' => 'user_control',
    'action' => 'resetPassword'
));
$router->add('/{language:[a-z]{2}+}/confirm/{code}/{uid}', array(
    'controller' => 'user_control',
    'action' => 'confirmEmail'
));
$router->add('/{language:[a-z]{2}+}/reset-password/{code}/{uid}', array(
    'controller' => 'user_control',
    'action' => 'resetPassword'
));
$router->add('/{language:[a-z]{2}+}/:controller/:action/:params/?', array(
  'controller' => 2,
  'action' => 3,
  "params"     => 4,
));
$router->add('/{language:[a-z]{2}+}/:controller/:action/?', array(
  'controller' => 2,
  'action' => 3,
));
$router->add('/{language:[a-z]{2}+}/:controller/?', array(
  'controller' => 2,
));
$router->add('/{language:[a-z]{2}+}/?', array(
  'controller' => 'index',
  'action' => 'index',
));
return $router;

the router will parse it reset-password as controller instead of using user_control as controller.

Vokuro\Controllers\ResetPasswordController handler class cannot be loaded
#0 [internal function]: Phalcon\Mvc\Dispatcher->_throwDispatchException('Vokuro\Controll...', 2)
#1 [internal function]: Phalcon\Dispatcher->dispatch()
#2 C:\xampp\htdocs\vokuro\public\index.php(27): Phalcon\Mvc\Application->handle()
#3 {main}
@ghost
Copy link

ghost commented Jan 13, 2014

Routes are traversed backwards, ie from the last one to the first one.

/zh/reset-password/somecode/3 will be matched by /{language:[a-z]{2}+}/:controller/:action/:params/?.

Try swapping

/{language:[a-z]{2}+}/:controller/:action/:params/?

and

'/{language:[a-z]{2}+}/reset-password/{code}/{uid}'

@nghenglim
Copy link
Author

Okay I've misunderstood it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants