ZF-11575: Creating translated URLs by the router in assemble() function

Issue Type: Bug Created: 2011-07-18T21:53:13.000+0000 Last Updated: 2011-08-05T19:02:41.000+0000 Status: Open Fix version(s): Reporter: Patryk Stepniewski (sferis) Assignee: Ben Scholzen (dasprid) Tags: - Zend_Controller_Router

Related issues: Attachments:


There is a problem when generating translated URLs with default params via Zend_Controller_Router.


<pre class="highlight">
resources.router.routes.language.type = Zend_Controller_Router_Route
resources.router.routes.language.route = ":language"
resources.router.routes.language.reqs.language = "^(en|pl)$"
resources.router.routes.language.defaults.language = "en"

resources.router.routes.defaultraw.type = Zend_Controller_Router_Route  
resources.router.routes.defaultraw.route = :@controller/:@action/*
resources.router.routes.defaultraw.defaults.module = "default"
resources.router.routes.defaultraw.defaults.controller = "index"
resources.router.routes.defaultraw.defaults.action = "index"    

resources.router.routes.default.type = Zend_Controller_Router_Route_Chain
resources.router.routes.default.chain = "language, defaultraw"

Zend_Translate defines: ||English (en)||Polish (pl)|| |index|glowna|

As you can see the default action is index (pl: glowna) and default controller is index too. I'd like to generate URL to index controller and index action by assemble() function (Zend_Controller_Router) It works well in english which is default language (, but if I set polish it generates link like this: "glowna/glowna" is unnecessary, because these parameters are default!


It only requires one line change :-)

Class: Zend_Controller_Router_Route Function: assemble() Line: 397


<pre class="highlight">
if ($this->_isTranslated && $defaultValue !== null && isset($this->_translatable[$this->_variables[$key]])) {


<pre class="highlight">
if ($this->_isTranslated && $defaultValue !== null) {

Thanks for your patience

Enjoy ;-)


Posted by Patryk Stepniewski (sferis) on 2011-08-05T19:02:41.000+0000

Może byście się pospieszyli :/

Have you found an issue?

See the Overview section for more details.


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

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