Issues

ZF-2822: Zend_Controller_Action_Helper_Url::simple() doesn't prepend baseUrl in front of URL

Description

$urlHelper->simple('actionname', 'controlerName') returns "controlerName/actionName" which is quite unusable when application root != web server root.

For example: I'm generating form on http://example.com/mysite and in action param I want to put URL to controller "login" and action "go". To generate propel URL I need to do: $formAction = $baseUrl . $urlHelper->simple('actionName', 'controllerName'). In my opinion it should work just with helper: $formAction = $urlHelper->simple('actionName', 'controllerName');

Btw. $urlHelper->url('actionname', 'controlerName') works fine with it, and returns "/mysite/controlerName/actionName"

Comments

Please categorize/fix as needed.

Duplicate of ZF-2821

Matthew, why you marked it as duplicate of ZF-2821 ? ZF-2821 is about making absolute HTTP redirect, and this one is about prepending base url in url generated by $urlHelper->simple(). Resolwing one doesn't mean other one is resolved.

Regards, Piotrek

My bad -- I meant to mark it as related, not duplicates. I've modified the link now.

Scheduling for next minor release (new functionality).

Here's a patch, I tested where docroot = / and where docroot = /some/path

This is a one line fix. All that needs to be done is add "$request->getBaseUrl()" to the return of the simple() function, as per the patch code.

30 Minutes is too long of an estimate. Why isn't this fixed yet?

@Tianon , I agree, but it seems like Matthew hasn't had the time to do it yet. I've asked about it on the IRC channel and I've been told I should bring it up on the mailing list, but I haven't yet. You could probably speed it up by asking around on the mailing list.

@Tianon: please note that it is scheduled for 1.6.0. While the fix is trivial, it introduces a change in functionality, and we reserve new features for minor revisions.

Oh ok, that makes sense. Thanks for clarifying. :)

Anything new on this one? It's still not fixed in trunk rev. 10189 (Version 1.6.1 according to {{Zend_Version::VERSION}}).

It's not a real problem because you can overcome this issue by using {{$this->_helper->url->url(array('action' => 'actionName', 'controller' => 'controllerName'))}} but I'd be nice if it worked.

Well, the router in 1.6 implemented an assemble method that all helpers and methods like this are supposed to be using. I'm not sure why this one wouldn't have been yet (maybe nobody got around to it?). Now, I believe, this actually classifies as a BUG instead of just a Request for Change.

Fixed in svn r12436

PHP Bug hunt day (Andriesss)

Changing issues in preparation for the 1.7.0 release.