[TYPO3-core] RFC: #8205: Shortcut ends in parse_url-error

Martin Kutschker martin.kutschker-no at spam-blackbox.net
Mon Jun 16 13:11:32 CEST 2008


Steffen Kamper schrieb:
> "Martin Kutschker" <martin.kutschker-no at spam-blackbox.net> schrieb im 
> Newsbeitrag 
> news:mailman.1.1213608611.19296.typo3-team-core at lists.netfielders.de...
>> Steffen Kamper schrieb:
> 
>> I don't think it's correct to remove the host name arbitrarily from all 
>> arguents to the JS version of rawurlencode() in backend.php. If it must be 
>> removed (for whatever reason) then it must be removed before passing it to 
>> the function.
>>
>> Which remindes me that if you want to make the return URL relative to the 
>> TYPO3 backend it is not enough to remove the protocol/host as there might 
>> be a path prefix (eg http://my.domain/foo/bar/typo3). AFAIK the return 
>> URLs created from PHP are always URLs, so why should the JS version act 
>> differently?
>>
>> Masi
> 
> Hi Masi,
> 
> i compared the php-way and the JS-way, the only difference was the host 
> information, so i removed the host to be equal to php (php uses REQUEST_URI)
> 
> there is no way to remove it before, because it is build with 
> document.location which has the complete url, as there is no equivalent for 
> JS without the host information

You don't get my point. I can do it like this:

function x(arg) {
   // remove host on ALL parameters
   ...
   // do the real stuff
   ...
}
x(parameter)

or like that:

function x(arg) {
   // do the real stuff
   ...
}
parameter = 'whatever'
// remove host from paramter ONLY
...
x(parameter)

The difference is that in the second version the calling code does the 
removal. Your code does that on all arguments which is wrong. If you 
need it more than once, you can provide a wrapper 
rawurlencodeURLparams() that does this hostname removal magic.

And you could at least take the hostname (with or without the scheme) 
from location.host et al.

Masi


More information about the TYPO3-team-core mailing list