first_page

Regression in the Zend Framework Aimed Right at My Peeve

Buy this Book at Amazon.com! When a new version of the Zend Framework comes out, why does it have to regress over one my favorite features? I am still using Zend Framework version 1.0.3—because when I tried to use version 1.5.3 the ability have regular-expressions routes for the controller read from an XML file broke!

This problem is memorialized in the Zend Issue Tracker as “[#ZF-3474] Zend_Controller_Router_Route_Regex won’t assemble when used with xml config.” It looks like this problem was reported by Maurice Fonk and it’s assigned to Matthew Weier O’Phinney.

Maurice’s description of the problem reads like a step-by-step solution so I will generously assume that either Matthew was vacationing over the summer or he is totally swamped with other work. I am very reluctant to upgrade until this problem is fixed and am very surprised to see this regression happen.

Comments

Wil Sinclair, 2008-10-29 20:41:33

I can assure that it is not because he was on vacation. :) We're going to be focusing exclusively on bugs in the next week. I'll forward this to Matthew to see if he has anything to say about it.

,Wil

rasx(), 2008-10-29 20:46:08

I'm glad you guys got back to me quickly and am pleased that this issue is recognized and a response is underway!

Matthew Weier O'Phinney, 2008-10-31 01:19:31

I've investigated the issue, and yes, there was a regression... but it's because the original behavior was unreliable for complex regexes. 1.5.0 added functionality to make this more consistent and reliable in the form of a reverse URL map. You simply need to provide a "reverse" key in your route's XML config, with the value being a printf-compatible statement. In the example given in the issue tracker, you'd simply have "/archive/%s" as the value; the placeholders are replaced with values from the map, based on their index. I give full details in a comment on the issue, which I've now closed.

This feature is well documented in the manual page for the Regex route, by the way.

rasx(), 2008-10-31 07:55:37

I think I see where is going---so what happens when the last line below is missing:

routes.archive.type = "Zend_Controller_Router_Route_Regex" routes.archive.route = "archive/(\d+)" routes.archive.defaults.controller = "archive" routes.archive.defaults.action = "show" routes.archive.map.year = 1 routes.archive.reverse = "archive/%s"

?

It looks sort of redundant to me "archive/(\d+)" and "archive/%s"---so what is exactly being said here?

rasx()