view->url(): Clone $path if it's already of type Icinga\Web\Url

Avoids side effects in case of url params adjustments.

fixes #9351
This commit is contained in:
Johannes Meyer 2015-06-09 09:21:12 +02:00
parent f2c7d5686a
commit eba862a290
1 changed files with 5 additions and 0 deletions

View File

@ -20,7 +20,12 @@ $this->addHelperFunction('url', function ($path = null, $params = null) {
} else { } else {
$url = Url::fromPath($path); $url = Url::fromPath($path);
} }
if ($params !== null) { if ($params !== null) {
if ($url === $path) {
$url = clone $url;
}
$url->overwriteParams($params); $url->overwriteParams($params);
} }