Skip to content

Commit

Permalink
Do not modify the original NavigationItem if generating URL fails
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp committed Aug 29, 2024
1 parent 688fa97 commit 89761f7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Navigation/NavigationItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,12 @@ public function getHref(UrlParameterBag $urlParameterBag, bool $catch = false):
throw $e;
}

$this->targetPage = null;
$this->isDirectFallback = false;
$this->isCurrentPage = false;
$clone = clone $this;
$clone->targetPage = null;
$clone->isDirectFallback = false;
$clone->isCurrentPage = false;

return $this->getHref($urlParameterBag);
return $clone->getHref($urlParameterBag);
}

if (null !== ($queryString = $urlParameterBag->generateQueryString())) {
Expand Down

0 comments on commit 89761f7

Please sign in to comment.