diff --git a/src/Middleware/UnauthorizedHandler/CakeRedirectHandler.php b/src/Middleware/UnauthorizedHandler/CakeRedirectHandler.php index 620f2a2e..c601755d 100644 --- a/src/Middleware/UnauthorizedHandler/CakeRedirectHandler.php +++ b/src/Middleware/UnauthorizedHandler/CakeRedirectHandler.php @@ -69,10 +69,6 @@ protected function getUrl(ServerRequestInterface $request, array $options): stri $url = $options['url']; if ($options['queryParam'] !== null) { $uri = $request->getUri(); - /** @psalm-suppress NoInterfaceProperties */ - if (property_exists($uri, 'base')) { - $uri = $uri->withPath($uri->base . $uri->getPath()); - } $redirect = $uri->getPath(); if ($uri->getQuery()) { $redirect .= '?' . $uri->getQuery(); diff --git a/src/Middleware/UnauthorizedHandler/RedirectHandler.php b/src/Middleware/UnauthorizedHandler/RedirectHandler.php index 49ca85f4..33d8aa94 100644 --- a/src/Middleware/UnauthorizedHandler/RedirectHandler.php +++ b/src/Middleware/UnauthorizedHandler/RedirectHandler.php @@ -101,10 +101,6 @@ protected function getUrl(ServerRequestInterface $request, array $options): stri $url = $options['url']; if ($options['queryParam'] !== null && $request->getMethod() === 'GET') { $uri = $request->getUri(); - /** @psalm-suppress NoInterfaceProperties */ - if (property_exists($uri, 'base')) { - $uri = $uri->withPath($uri->base . $uri->getPath()); - } $redirect = $uri->getPath(); if ($uri->getQuery()) { $redirect .= '?' . $uri->getQuery(); diff --git a/tests/TestCase/Middleware/UnauthorizedHandler/CakeRedirectHandlerTest.php b/tests/TestCase/Middleware/UnauthorizedHandler/CakeRedirectHandlerTest.php index 79c77ee6..a03775e6 100644 --- a/tests/TestCase/Middleware/UnauthorizedHandler/CakeRedirectHandlerTest.php +++ b/tests/TestCase/Middleware/UnauthorizedHandler/CakeRedirectHandlerTest.php @@ -145,7 +145,7 @@ public function testHandleRedirectWithBasePath() $this->assertEquals(302, $response->getStatusCode()); $this->assertEquals( - '/basedir/login?redirect=%2Fbasedir%2Fadmin%2Fdashboard', + '/basedir/login?redirect=%2Fadmin%2Fdashboard', $response->getHeaderLine('Location') ); } diff --git a/tests/TestCase/Middleware/UnauthorizedHandler/RedirectHandlerTest.php b/tests/TestCase/Middleware/UnauthorizedHandler/RedirectHandlerTest.php index f5e65422..9e75d125 100644 --- a/tests/TestCase/Middleware/UnauthorizedHandler/RedirectHandlerTest.php +++ b/tests/TestCase/Middleware/UnauthorizedHandler/RedirectHandlerTest.php @@ -146,7 +146,7 @@ public function testHandleRedirectWithBasePath() $this->assertEquals(302, $response->getStatusCode()); $this->assertEquals( - '/basedir/login?redirect=%2Fbasedir%2Fpath', + '/basedir/login?redirect=%2Fpath', $response->getHeaderLine('Location') ); }