From f2cd79ecbbaa848260d70f35c40cabc206d6644c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dezs=C5=91=20BICZ=C3=93?= Date: Fri, 26 Oct 2018 10:34:05 +0200 Subject: [PATCH 1/2] Path prefix must be present Make sure the path prefix is actually present even if the request has been altered before. --- src/Plugin/AddPathPlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Plugin/AddPathPlugin.php b/src/Plugin/AddPathPlugin.php index 93ded1c..22fc26a 100644 --- a/src/Plugin/AddPathPlugin.php +++ b/src/Plugin/AddPathPlugin.php @@ -48,7 +48,7 @@ public function handleRequest(RequestInterface $request, callable $next, callabl { $identifier = spl_object_hash((object) $first); - if (!array_key_exists($identifier, $this->alteredRequests)) { + if (!array_key_exists($identifier, $this->alteredRequests) || strpos($request->getUri()->getPath(), $this->uri->getPath()) !== 0) { $request = $request->withUri($request->getUri() ->withPath($this->uri->getPath().$request->getUri()->getPath()) ); From b01f8c6ef11c57cbf91a50779a45482e92ba7046 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dezs=C5=91=20BICZ=C3=93?= Date: Fri, 26 Oct 2018 11:20:08 +0200 Subject: [PATCH 2/2] CS fix. --- src/Plugin/AddPathPlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Plugin/AddPathPlugin.php b/src/Plugin/AddPathPlugin.php index 22fc26a..d03be50 100644 --- a/src/Plugin/AddPathPlugin.php +++ b/src/Plugin/AddPathPlugin.php @@ -48,7 +48,7 @@ public function handleRequest(RequestInterface $request, callable $next, callabl { $identifier = spl_object_hash((object) $first); - if (!array_key_exists($identifier, $this->alteredRequests) || strpos($request->getUri()->getPath(), $this->uri->getPath()) !== 0) { + if (!array_key_exists($identifier, $this->alteredRequests) || 0 !== strpos($request->getUri()->getPath(), $this->uri->getPath())) { $request = $request->withUri($request->getUri() ->withPath($this->uri->getPath().$request->getUri()->getPath()) );