diff --git a/e2e-testing/src/Http/PhpRouter.php b/e2e-testing/src/Http/PhpRouter.php index 7527814..1ec886c 100644 --- a/e2e-testing/src/Http/PhpRouter.php +++ b/e2e-testing/src/Http/PhpRouter.php @@ -25,7 +25,7 @@ public static function generate(string $index, string $prelude = ''): string $prelude - \$path = rawurldecode(parse_url(\$_SERVER['REQUEST_URI'], PHP_URL_PATH) ?? '/'); + \$path = rawurldecode((string) parse_url(\$_SERVER['REQUEST_URI'], PHP_URL_PATH) ?: '/'); if ('/' !== \$path && is_file(\$_SERVER['DOCUMENT_ROOT'].\$path)) { return false; diff --git a/e2e-testing/tests/LocalApplicationServerTest.php b/e2e-testing/tests/LocalApplicationServerTest.php index 187d829..bbbbd0f 100644 --- a/e2e-testing/tests/LocalApplicationServerTest.php +++ b/e2e-testing/tests/LocalApplicationServerTest.php @@ -65,6 +65,19 @@ public function testPhpServerHandlesFrontControllerRoutesAndStaticFilesAndStops( $this->assertStopped($server->baseUri); } + public function testPhpServerPassesDoubleSlashRequestsToTheFrontController(): void + { + $server = (new WebServerManager())->start(WebServerConfig::php($this->directory)); + + try { + $response = HttpClient::create()->request('GET', $server->baseUri.'//'); + $this->assertSame(200, $response->getStatusCode()); + $this->assertSame('//', $response->toArray()['uri']); + } finally { + $server->stop(); + } + } + public function testServerLoggingCannotBlockRequests(): void { (new Filesystem())->dumpFile($this->directory.'/public/index.php', '