ZF-10712: Assemble doesn't appends new parameters at the end of a url
Description
I noticed that the URL-view-helper doesn't work as expected (in my opinion) as it doesn't append new variables to the end of a URL. It adds new variables at the beginning of the parameters part of the url, an example:
If I have a current URL like {quote} http://example.com/module/controller/… {quote} and use the URL-view-helper in this way: {quote} <?php echo $this->url('param2' => 'value2'); ?> {quote} the url is {quote} http://example.com/module/controller/… {quote} instead of {quote} http://example.com/module/controller/… {quote}
I think the last URL is the expected result (appending new variables to the end)...
As I needed this behavior I searched for a solution and found one in Zend_Controller_Router_Route::assemble on line 374 (in v1.11.0)...
Replacing {quote} if (!$reset) $data += $this->_wildcardData; {quote} with {quote} if (!$reset) $data = $this->_wildcardData + $data; {quote} solves the problem. But I don't know if this is really a bug or a feature and if this is the best way to solve that...
Regards,
Chaos
Comments
Posted by Matthew Weier O'Phinney (matthew) on 2010-11-19T06:40:42.000+0000
Why does the order matter, exactly? These are key/value pairs, and order should not be an issue. Can you explain the use case?
Posted by 2called-chaos (2called-chaos) on 2010-11-19T09:26:05.000+0000
In my case it is a bit of aesthetics and sense... {quote} /payment/select/pay-method/for-product/foo/with-addons/bar,baz {quote} makes more sense and looks better than {quote} /payment/select/pay-method/with-addons/bar,baz/for-product/foo {quote}
Just my opinion but I think it's intuitive or expected that new things will be appended instead of be placed anywhere in the middle...
Regards,
Chaos