Skip to content

Commit

Permalink
resolve ternary always true
Browse files Browse the repository at this point in the history
  • Loading branch information
imorland committed Jan 5, 2024
1 parent 19168b6 commit 40dfb1f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions framework/core/src/Forum/Controller/LogOutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ public function handle(Request $request): ResponseInterface
$actor = RequestUtil::getActor($request);
$base = $this->url->to('forum')->base();

$rurl = (string) Arr::get($request->getQueryParams(), 'return');
$return = $this->sanitizeReturnUrl($rurl, $base);
$rurl = Arr::get($request->getQueryParams(), 'return');
$return = $this->sanitizeReturnUrl((string) $rurl, $base);

// If there is no user logged in, return to the index or the return url if it's set.
if ($actor->isGuest()) {
Expand All @@ -107,7 +107,7 @@ public function handle(Request $request): ResponseInterface

if (Arr::get($request->getQueryParams(), 'token') !== $csrfToken) {
$view = $this->view->make('flarum.forum::log-out')
->with('url', $this->url->to('forum')->route('logout') . '?token=' . $csrfToken . ($return ? '&return=' . urlencode($return) : ''));
->with('url', $this->url->to('forum')->route('logout') . '?token=' . $csrfToken . ($rurl ? '&return=' . urlencode($return) : ''));

return new HtmlResponse($view->render());
}
Expand Down

0 comments on commit 40dfb1f

Please sign in to comment.