ZF-11443: Zend_Controller_Router_Route_Chain does not implement getDefault and getDefaults

Issue Type: Improvement Created: 2011-06-05T11:53:37.000+0000 Last Updated: 2013-02-06T09:56:41.000+0000 Status: Resolved Fix version(s): - 1.12.2 (25/Feb/13)

Reporter: Môshe van der Sterre (môshevds) Assignee: Frank Brückner (frosch) Tags: - Zend_Controller_Router

Related issues: - ZF-11545



Zend_Controller_Router_Route_Chain does not implement getDefault and getDefaults. All other shipped Route implementations provide this, and I see no reason for not providing these on Chain as well.

Note: getDefault and getDefaults are not required by Zend_Controller_Router_Route_Interface.


Posted by Môshe van der Sterre (môshevds) on 2011-06-05T13:32:44.000+0000

See also:

Posted by Kai Uwe (kaiuwe) on 2011-06-05T21:47:39.000+0000

There are two mistakes in your code: * Coding style: "As with classes, the brace should always be written on the line underneath the function name." ("getDefault" and "getDefaults") * In the method "getDefault" the variable "$default" is undefined

Posted by Môshe van der Sterre (môshevds) on 2011-06-06T00:51:25.000+0000

You are right about the potentially undefined variable, thanks. The style is also wrong in the other Route implementations, that is where I copy-pasted the line from.

At first I implemented the function to return the default from the least specific (first added/first matching) route. I changed that to most specific at the last moment (to match the behaviour of the Chain), hence the missing $default definition.

The documentation notes the parameter priority as 'the outer route has the higher priority'. I'm not sure how to interpret that in combination with the actual behaviour, maybe it is an documentation error.

Posted by Frank Brückner (frosch) on 2011-09-07T17:45:04.000+0000

Fix and unit test from Môshe tested and added.

Posted by Adam Lundrigan (adamlundrigan) on 2011-12-01T12:03:52.000+0000

@[~môshevds]: You will need to sign and submit a CLA before we can apply your suggested improvement. See here:…

Posted by Frank Brückner (frosch) on 2012-03-21T21:16:13.000+0000

Can we add the patch to version 1.12?

Posted by Frank Brückner (frosch) on 2013-02-06T09:56:41.000+0000

Fixed on trunk (25248) and release-1.12 (25249)

(I deleted the patches from Môshe and written a new implementation.)

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.