Routing, excess parameters, and 404

I have noticed, if you pass any extra parameter into the uri, a route would be performed even so. For example, controller 'Sign' has the action 'up' with no arguments; such links will do the same: An unlimited amount of links are doing the same...

Now I'm trying to use some custom plugin with method's arguments checking by php5 reflections: if there is no argument but one has been placed into the uri then 404 is shown. But all this don't look flexible and handy.

Want to listen some suggestions from developers.

edited Oct '14

By default Phalcon uses the following route to accept an arbitrary number of parameters:


You can replace it to limit the number of parameters:

$router->add('#^/([a-zA-Z0-9\_]+)/([a-zA-Z0-9\.\_]+)(/.*){0,32}$#', array('controller' => 1, 'action' => 2, 'params' => 3));


Thanks, but wanted something more dynamically. At least, to specify parameters inside the controller.

I thought about the annotations router. I could leave :contrller/:action part as is and check :params only which would be specified in action's annotation. And then check requested and required ones by plugin. But, as I read in other threads, annotations may slow perform. But what about the annotations meta-data? Does it be faster if store annotations meta-data into the memory?


Actually, all the meta-data is stored in memory, using annotations is an option to manually define the meta-data rather than let phalcon instrospect it by reading the column information from the database information schema.