I've having some trouble with route chains when the last route in the chain
contains only optional variables. E.g. given these two example routes:
$firstRoute = new Zend_Controller_Router_Route_Static('foo/bar');
$secondRoute = new Zend_Controller_Router_Route(':action', array(
'module' => 'test',
'controller' => 'index',
'action' => 'index'
));
$chain = new Zend_Controller_Router_Route_Chain();
$chain->chain($firstRoute)
->chain($secondRoute);
This:
$request = new Zend_Controller_Router_ChainTest_Request('
http://example.com/foo/bar/wibble' <http://example.com/foo/bar/wibble%27>);
var_dump($chain->match($request));
works as expected, however:
$request = new Zend_Controller_Router_ChainTest_Request('
http://example.com/foo/bar);
var_dump($chain->match($request));
outputs false, even though this is a perfectly valid route. Having looked at
the route chain class, it seems that if it runs out of request before it's
finished checking all the routes it just returns no match.
Obviously my code above is a contrived example, as the two routes could
easily be combined; but I have some custom route classes for hierarchical
routing (/category/subcategory etc.) which would be difficult to merge.
Is this worth opening an issue for, am I better off just creating my own
route chain class, or am I misunderstanding how route chains are supposed to
be used?
--
Tim Fountain
http://tfountain.co.uk/