ZF-11788: Wrong action in translated segment controller (use always the same action)

Issue Type: Bug Created: 2011-10-01T14:04:18.000+0000 Last Updated: 2012-03-22T11:58:22.000+0000 Status: Open Fix version(s): Reporter: Michael (michaelb) Assignee: Ben Scholzen (dasprid) Tags: - Zend_Controller_Router

Related issues: Attachments:



I create a "site/application" that automatically build navigation (for menu, ...) from database and i also created an .ini file with routes. I also use translation segment in controller name.

<pre class="highlight">
; Login - /fr/questions or /de/fragen
routes.faq_index.route = ":lang/:@controller"
routes.faq_index.defaults.module = default
routes.faq_index.defaults.controller = faq
routes.faq_index.defaults.action = index
routes.faq_index.reqs.lang = "^(fr|de)$"

; Product index - /fr/produits /de/produkte
routes.product_index.route = ":lang/:@controller"
routes.product_index.defaults.module = default
routes.product_index.defaults.controller = product
routes.product_index.defaults.action = supplierlist
routes.product_index.reqs.lang = "^(fr|de)$"

When i open url "/fr/produits" or "/de/produkte" all is fine, page show correct results, one in french and other page in german.

If now i go to "/fr/questions" or in german (is before in the routes.ini file)... i got that error (see below). If i inverse this 2 routes in the file, it works with "/fr/questions" but no more with "/fr/produits" (take index action and not supplierlist)

<pre class="highlight">
An error occurred
Page not found
Exception information:

Message: Action "supplierlist" does not exist and was not trapped in __call()
Stack trace:

#0 /var/www/cms.1234.local/bin/1234cms/library/Zend/Controller/Action.php(518): Zend_Controller_Action->__call('supplierlistAct...', Array)
#1 /var/www/cms.1234.local/bin/1234cms/library/Zend/Controller/Dispatcher/Standard.php(295): Zend_Controller_Action->dispatch('supplierlistAct...')
#2 /var/www/cms.1234.local/bin/1234cms/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#3 /var/www/cms.1234.local/bin/1234cms/library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#4 /var/www/cms.1234.local/bin/1234cms/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#5 /var/www/cms.1234.local/bin/1234cms/public/index.php(26): Zend_Application->run()
#6 {main}

<pre class="highlight">
array (
  'lang' => 'fr',
  'controller' => 'faq',
  'module' => 'default',
  'action' => 'supplierlist', // THIS IS WRONG, MUST TO BE "INDEX" IF I REFER TO THE ROUTES.INI FILE

In the navigation i added pages like that:

<pre class="highlight">
faq.label = faq_label
faq.route = faq_index

product.label = product_label
product.route = product_index

It open the right controller but the "action" still always "supplierlist" in that case (the last one in the routes.ini file) Why?

I also tried to create one route like that:

<pre class="highlight">
routes.custom.route = ":lang/:@controller"
routes.custom.reqs.lang = "^(fr|en)$"

and specify in the navigation.ini file, route (custom), controller, action.. but is the same result!

I don't know if is a bug but for me is not the an normal behavior. If i'm wrong, feel free to tell me, but this "problem" or "bug" block me in a big project..

Thanks in advance,


Posted by Frank Br├╝ckner (frosch) on 2012-03-22T11:58:22.000+0000

The creation of URLs is not in the remit of Zend_Navigation.

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.