If you've gone through the process of checking for the bug in the issue tracker already and asked here, we encourage you to file an issue. Worst case scenario, we'll close it as 'not an issue' with an explanation why. In any case, this will make us deal with it at some point. :)
,Wil -----Original Message----- From: news [mailto:[email protected]] On Behalf Of Colin Guthrie Sent: Thursday, March 19, 2009 8:57 AM To: [email protected] Subject: [fw-general] Re: Potential bug in Regex routing regarding the $reset parameter 'Twas brillig, and Colin Guthrie at 17/03/09 17:33 did gyre and gimble: > Hi, > > Just looking to see if I've got any conceptual problems here prior to > submitting a proper bug report/patch. > > In Zend_View_Helper_Url the reset parameter is documented as: > "Whether or not to reset the route defaults with those provided". > > I've always taken this to mean that if the route being assembled is the > same as the one matched on the current request, do not use the values > extracted from the current request when assembling if this argument is > true. > > So question one is, is this assumption correct? > > Assuming I am correct, when I look at the assemble() method of > Zend_Controller_Router_Route_Regex it's clearly evident that the $reset > parameter is completely ignored and $this->_values is always used. > > So under this logic, it is impossible to e.g. link to the same route as > currently matched but with different values for some params, but leaving > others to be filled in by their default values when said missing params > were actually supplied in the currently matched route! > > Phew, that last sentence was a hard one to follow, so I'll do an example. > > > Say I have a route: > > new Zend_Route_Regex( > 'foo(?:/([\w-]+)(?:/([0-9]+))?)?', > array('module' => 'blah', 'controller' => 'blah', 'action' => 'blah', > 'arg1' => bar, 'arg2' => 1), > array(1 => 'arg1', 2 => 'arg2') > ); > > > If the following URL is matched > /foo/bar/42 > > And I use a view helper to create a new link on that page via: > $this->url(array('arg1' => 'oink'), null, true); > > Then I'd expect a route of: > /foo/oink > to be produced (because null will match the current route, and true says > the current values should be ignored. > > However this actually produces a route: > /foo/oink/42 > > As the value matched in the current route is not reset as you would expect. > > This is the same regardless of the $reset parameter so: > $this->url(array('arg1' => 'oink'), null, false); > will also produce the same result: > /foo/oink/42 > > > So, my second question: is this a bug, or am I misunderstanding what > $reset should do? Well I presume that the lack of response to this question means it's probably a real bug or people just don't know, so I've submitted it (along with a patch) to: http://www.framework.zend.com/issues/browse/ZF-6065 for those who care :) Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mandriva Linux Contributor [http://www.mandriva.com/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/]
