Issue Type: Patch Created: 2009-03-13T09:47:23.000+0000 Last Updated: 2011-05-02T20:21:18.000+0000 Status: Resolved Fix version(s): - 1.11.6 (05/May/11)
Reporter: Andreas Streichardt (mop) Assignee: Kim Blomqvist (kblomqvist) Tags: - Zend_Controller
Related issues: Attachments: - Redirector.patch
I have implemented a custom routing and my action parameter isn't "action" but something different. This is all handled inside my routing stuff and works just fine. Unfortunately the redirector helper is hardcoded to "action" in setGotoSimple().
The following patch fixes it for me:
<pre class="highlight"> --- a/wcp/3rd/Zend/Controller/Action/Helper/Redirector.php +++ b/wcp/3rd/Zend/Controller/Action/Helper/Redirector.php @@ -269,9 +269,9 @@ class Zend_Controller_Action_Helper_Redirector extends Zend_Controller_Action_He } } - $params['module'] = $module; - $params['controller'] = $controller; - $params['action'] = $action; + $params[Zend_Controller_Front::getInstance()->getRequest()->getModuleKey()] = $module; + $params[Zend_Controller_Front::getInstance()->getRequest()->getControllerKey()] = $controller; + $params[Zend_Controller_Front::getInstance()->getRequest()->getActionKey()] = $action; $router = $this->getFrontController()->getRouter(); $url = $router->assemble($params, 'default', true);
I just started with Zend Framework and this might not be the best fix but it works for me ;) But i am sure you get the problem i am facing.
Posted by julien PAULI (doctorrock83) on 2009-03-16T01:24:35.000+0000
Good one, I think the patch looks good. Perhaps FC should'nt come from the singleton but from the Controller.
Posted by Andreas Streichardt (mop) on 2011-04-20T15:03:46.000+0000
this (quite easyly fixable) bug is in here since 2 years and i still have to apply my fix for every ZF Update. Could somebody please fix that? :|
Posted by Kim Blomqvist (kblomqvist) on 2011-04-22T11:11:36.000+0000
Posted by Adam Lundrigan (adamlundrigan) on 2011-04-29T14:16:44.000+0000
Seems like a good, straightforward fix to me. My only reservation is that it changes the expected behavior of that function, so I would like to see a member of the ZF team comment on the change. That said, in my eyes, it's an internal process that applications built upon ZF shouldn't be depending directly on, so I don't see possibility of a BC break here.
One suggestion: Use $this->getFrontController() instead of Zend_Controller_Front::getInstance() to maintain consistency with the rest of the class.
Posted by Kim Blomqvist (kblomqvist) on 2011-04-29T14:21:56.000+0000
bq. One suggestion: Use $this->getFrontController() instead of Zend_Controller_Front::getInstance() to maintain consistency with the rest of the class.
The patch does not call Zend_Controller_Front::getInstance(). The Request object is already available there and it has been used to get module, controller, action key names.
Posted by Adam Lundrigan (adamlundrigan) on 2011-05-02T18:11:52.000+0000
@Kim: Apologies. I was looking at the bug description, not the attached patch file.
Posted by Matthew Weier O'Phinney (matthew) on 2011-05-02T20:21:18.000+0000
Patch reviewed and applied to trunk and 1.11 release branch.
Have you found an issue?
See the Overview section for more details.