Issues

ZF-4387: Use Controller_Front's baseUrl

Description

Zend_Form::setAction($this->_helper->url(...)) and other components relying on Zend/Controller/Action/Helper/Url.php get wrong URLs when Zend_Controller_Front::setBaseUrl() is used.

I've noticed this in a modularized directory layout when setting form's action. I was unable to continue developing in my environment without this fix.

Please review, and explain me if something is wrong with the patch, as I've been using ZF only for three days now.

Regards, Flavius Aspra -- The diff --- library/Zend/Controller/Action/Helper/Url.php (revision 11520) +++ library/Zend/Controller/Action/Helper/Url.php (working copy) @@ -56,10 +56,12 @@

     if (null === $module) {
         $module = $request->getModuleName();

- } + }

  • $fc = $this->getFrontController();
  • $url = $controller . '/' . $action;
  • if ($module != $this->getFrontController()->getDispatcher()->getDefaultModule()) {
  • if ($module != $fc->getDispatcher()->getDefaultModule()) { $url = $module . '/' . $url; }

@@ -72,7 +74,7 @@ $url .= '/' . $paramString; }

  • $url = '/' . ltrim($url, '/');
  •  $url = '/' . ltrim($fc->getBaseUrl() . '/' . $url, '/');
    
     return $url;
    

    }

Comments

Same ZF-2822

Updating these issues to mark them resolved for 1.7.1.