Nick --

The fix looks good, though I want to add some unit tests to verify.
Could you put this in the issue tracker, please?

Thanks!

-- Nick Howell <[EMAIL PROTECTED]> wrote
(on Monday, 16 July 2007, 08:03 PM -0400):
> This seems like an error to me, but then again perhaps I am confused by the
> expected functionality...
> I am doing a $this->_redirector->goto(null,null,'admin'); inside my
> Admin_ClassController->viewAction()
> What I expect to happen here is for the page to redirect to 
> http://example.com/
> admin but it goes to http://example.com/admin/class instead. Granted, I can do
> a $this->_redirector->goto(null,'index','admin'); but then I get http://
> example.com/admin/index (I'd prefer to not have the extra /index on the end).
> 
> Looks like a problem in Zend_Controller_Action_Helper_Redirector->setGoto();
> ...
> 
>         if (null === $controller) {
>             $controller = $request->getControllerName();
>             if (empty($controller)) {
>                 $controller = $dispatcher->getDefaultControllerName();
>             }
>         }
> 
> should be:
> 
>         if (null === $controller) {
>             if (null !== $action) {
>                 $controller = $request->getControllerName();
>                 if (empty($controller)) {
>                     $controller = $dispatcher->getDefaultControllerName();
>                 }
>             }
>         }
> 
> The addition checks to see if the $action was set, THEN we can get the
> $controller if it was not set - otherwise leave $controller as null.
> I tested this change in my application and the problem was solved.
> 
> This also keeps the functionality consistent because you can now do a $this->
> _redirector->goto(null); and be redirected to the current module index rather
> than the controller you are currently in.
> 
> Can anyone confirm my logic behind this? If so, let's see this in the next
> release pretty please :-)
> 
> Thanks,
> Nick Howell

-- 
Matthew Weier O'Phinney
PHP Developer            | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/

Reply via email to