}
if ($url instanceof Horde_Url) {
- $url->raw = !$encode;
- return $url->add($parameter, $value);
+ // In many places we re-use URLs assuming they are strings. With
+ // Horde_Url objects, this can lead to reference problems and URLs
+ // being mysteriously modified. For now, we have to clone any
+ // objects to avoid modifying them.
+ $url2 = clone($url);
+ $url2->raw = !$encode;
+ return $url2->add($parameter, $value);
}
$horde_url = new Horde_Url($url, !$encode);
*/
static public function removeParameter($url, $remove)
{
- $horde_url = new Horde_Url($url);
-
if ($url instanceof Horde_Url) {
- return $url->remove($remove);
+ // In many places we re-use URLs assuming they are strings. With
+ // Horde_Url objects, this can lead to reference problems and URLs
+ // being mysteriously modified. For now, we have to clone any
+ // objects to avoid modifying them.
+ $url2 = clone($url);
+ return $url2->remove($remove);
}
+ $horde_url = new Horde_Url($url);
return $horde_url->remove($remove);
}