ZF-9973: Zend_Controller_Router_Route::assemble with translation does wrong check on default values

Issue Type: Bug Created: 2010-06-10T01:37:56.000+0000 Last Updated: 2012-11-20T21:37:41.000+0000 Status: Open Fix version(s): Reporter: Philipp Simon (biggs) Assignee: None Tags: - Zend_Controller

Related issues: Attachments:


There is a little bug in Zend_Controller_Router_Route::assemble() method, when you have default values and using translation feature. Currently it will produce full length url when assembling even though specified paramters are equal to default paramters. This is because in line 394, there is a wrong check and so the translated value is compared against the not translated value. (and so the parameter always gets added to url)

So please change this (line 394-396)

{quote} if ($this->_isTranslated && $defaultValue !== null && isset($this->_translatable[$this->_variables[$key]])) { $defaultValue = $translator->translate($defaultValue, $locale); } {quote}

to this

{quote} if ($this->_isTranslated && $defaultValue !== null && in_array($this->_variables[$key], $this->_translatable)) { $defaultValue = $translator->translate($defaultValue, $locale); } {quote}


No comments to display

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.