Problem with - 404

Hi, can you help me? I have a little problem with routing, I think it's a bug. I can't find solution ...

I have router with $router->notFound(array( ... )) , router with param false and now:

1) Use only static routes:

$router->add('/aa/vvv', array(
  'module' => 'index',
  'controller' => "a",
  'action' => "v",
));

on every routes, which not exists, that's work correct, but when I added e.g.:

Route: /xx/bbb (route and files doesn't exists, correctly 404 - it's ok)

Route: /aa/vvv (route exists and files doesn't exists => exception - it's ko)

There is a problem with route, if the controller "a" or action "v" doesn't exists. I can't change controller and action in event (dispatch:beforeException) with $dispatcher->forward to the error (only when controller doesn't exists, but route yes). Router looks like that's ok...


2) Dynamic routes (it's the some): When you define:

$router->add('/:controller/:action', array(
        'module'     => 'index',
        'controller' => 1,
        'action'     => 2,
));
$router->notFound(array( ... ))

e.g.:

Route: / (index/index - exists => dispatch - it's ok)

Route: /index/test (index/test - exists => dispatch - it's ok)

Route: /aaa/bbb (Controller doesn't exists => exception - it's KO => I want 404/500, not exception and die.)

Route: /aa/bb/cc (doesn't exists, but go correctly to 404 - it's ok)

Exception is from: $application->handle()->getContent(). I think, there is a problem in dispatcher, when was the route by router matched, but controller or action doesn't exists. When I look on google, there are a lots of sites with this exception.

edited Nov '14

If you are talking about track error pages on wrong controller/action Phalcon doesn't provide this function by default

do something like this https://github.com/phalconist/phalconist/blob/master/public/index.php#L49

or this

https://github.com/ovr/phalcon-module-skeleton/blob/master/application/config/core.php#L50

About routers error I didnt understand create an example, upload on gist and say phalcon version