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
Posted by Wil Sinclair (wil) on 2008-03-25T20:41:12.000+0000
Please categorize/fix as needed.
Posted by Matthew Weier O'Phinney (matthew) on 2008-04-22T10:38:02.000+0000
Duplicate of ZF-2821
Posted by Piotr Czachur (zimnyx) on 2008-04-23T03:37:05.000+0000
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
Posted by Matthew Weier O'Phinney (matthew) on 2008-04-23T06:49:45.000+0000
My bad -- I meant to mark it as related, not duplicates. I've modified the link now.
Posted by Matthew Weier O'Phinney (matthew) on 2008-05-09T11:12:41.000+0000
Scheduling for next minor release (new functionality).
Posted by Stephen Crosby (stevecrozz) on 2008-06-27T15:01:09.000+0000
Here's a patch, I tested where docroot = / and where docroot = /some/path
Posted by Tianon Gravi (admwiggin) on 2008-07-25T10:25:14.000+0000
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?
Posted by Stephen Crosby (stevecrozz) on 2008-07-25T10:40:10.000+0000
@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.
Posted by Matthew Weier O'Phinney (matthew) on 2008-07-25T12:03:50.000+0000
@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.
Posted by Tianon Gravi (admwiggin) on 2008-07-26T18:26:02.000+0000
Oh ok, that makes sense. Thanks for clarifying. :)
Posted by Stefan Gehrig (sgehrig) on 2008-09-17T02:42:17.000+0000
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.
Posted by Tianon Gravi (admwiggin) on 2008-09-17T13:13:17.000+0000
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.
Posted by Andries Seutens (andries) on 2008-11-08T07:42:16.000+0000
Fixed in svn r12436
PHP Bug hunt day (Andriesss)
Posted by Wil Sinclair (wil) on 2008-11-13T14:10:23.000+0000
Changing issues in preparation for the 1.7.0 release.