OS: Ubuntu 14.04 Server: nginx/1.4.6 (Ubuntu) Php: 5.5.9-1ubuntu4.6 (fpm-fcgi) Phalcon: 1.3.4
$testRoutes = array(
'/',
'/account',
'/account/register',
'/products/show/101',
);
$router = new Phalcon\Mvc\Router();
$router->add("(/?)", "frontend::index::index"); //works
$router->add("/:controller/?", "frontend::1::index"); //works
$router->add("/:controller/:action/?", "frontend::1::2"); //fails with Controller: '', Action: ''
$router->add("/:controller/:action/:params/?", "frontend::1::2::3"); //fails with Controller: '', Action: ''
//Testing each route
foreach ($testRoutes as $testRoute) {
$router->handle($testRoute);
echo 'Testing ', $testRoute, PHP_EOL;
if ($router->wasMatched()) {
echo 'Controller: ', $router->getControllerName(), PHP_EOL;
echo 'Action: ', $router->getActionName(), PHP_EOL;
}
echo PHP_EOL;
}
This isn't breaking behaviour, as it can be done with the array syntax, but one would assume this would work?
Thanks.