bugfix: url's containg var[]=val got corrupted

This commit is contained in:
Ralf Becker 2006-05-17 05:53:12 +00:00
parent 40c4e903e8
commit 32dc4fdb8b

View File

@ -1176,7 +1176,14 @@
foreach(explode('&',$extravars) as $expr)
{
list($var,$val) = explode('=', $expr,2);
$vars[$var] = $val;
if (substr($var,-2) == '[]')
{
$vars[substr($var,0,-2)][] = $val;
}
else
{
$vars[$var] = $val;
}
}
}
@ -1194,7 +1201,17 @@
$query = array();
foreach($vars as $key => $value)
{
$query[] = $key.'='.urlencode($value);
if (is_array($value))
{
foreach($value as $val)
{
$query[] = $key.'[]='.urlencode($val);
}
}
else
{
$query[] = $key.'='.urlencode($value);
}
}
$url .= '?' . implode('&',$query);
}