Skip to content

Commit

Permalink
pkp#10818 Quoted regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasraoni committed Jan 18, 2025
1 parent 5e6eb80 commit 28159e4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions classes/core/PKPPageRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -529,10 +529,10 @@ private function _setLocale(PKPRequest $request, ?string $setLocale): void
}

$indexUrl = $this->getIndexUrl($request);
$uri = preg_replace("#^{$indexUrl}#", '', $setLocale ? ($_SERVER['HTTP_REFERER'] ?? '') : $request->getCompleteUrl(), 1);
$uri = preg_replace('/^' . preg_quote($indexUrl, '/') . '/', '', $setLocale ? ($_SERVER['HTTP_REFERER'] ?? '') : $request->getCompleteUrl(), 1);
$newUrlLocale = $multiLingual ? "/{$newLocale}" : '';
$pathInfo = $uri
? preg_replace("#^/{$contextPath}" . ($urlLocale ? "/{$urlLocale}" : '') . '(?=[/?\\#]|$)#', "/{$contextPath}{$newUrlLocale}", $uri, 1)
? preg_replace('/^' . preg_quote("/{$contextPath}" . ($urlLocale ? "/{$urlLocale}" : ''), '/') . '(?=[/?\\#]|$)#', "/{$contextPath}{$newUrlLocale}", $uri, 1)
: "/index{$newUrlLocale}";

$request->redirectUrl($indexUrl . $pathInfo);
Expand Down

0 comments on commit 28159e4

Please sign in to comment.