[TYPO3-core] RFC: typolink .addQueryString fix

Martin Kutschker Martin.Kutschker at blackbox.net
Sun Apr 2 10:33:52 CEST 2006


Bernhard Kraft <kraftb at kraftb.at> writes on 
Sat, 01 Apr 2006 23:45:08 +0200 (METDST):

> 
> Problem:
> If the query-parameters are multidimensional like:
> tx_whatever[single]=12&tx_whatever[page]=3
> 
> then the bottom lines of tslib_content.php method
> "getQueryArguments":
> ----
> $content = '';
> foreach ($q_out as $k => $v) {
> $content .= '&'.$k.'='.($rawValues ? $v : rawurlencode($v));
> }
> return $content;
> ---
> 
> will fail with a php error complaining that php can't realurlencode an
> array (which $v is).


Yes. Noticed only yesterday :-(



> Solution:
> Obvious. Use "t3lib_div::implodeArrayForUrl" instead of NO API-Call at
> all.


It has slipped your notice that rawurlencode() is only called when $rawValues==FALSE. The code does not build arrays when QUERY_STRING is used.

if ($rawValues) {
$content = '';
foreach ($q_out as $k => $v) {
$content .= '&'.$k.'='$v;
}
} else {
$content = t3lib_div::implodeArrayForUrl('', $q_out);
}
return $content;

Masi 



More information about the TYPO3-team-core mailing list