From 1a21559912b95db0d74171c91f7848981f77a8f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Sat, 6 Oct 2018 12:51:03 +0200 Subject: [PATCH] Fix routes support when using the PHP built-in web server --- symfony/framework-bundle/3.3/post-install.txt | 2 +- symfony/framework-bundle/3.3/public/index.php | 4 ++++ symfony/framework-bundle/4.2/post-install.txt | 2 +- symfony/framework-bundle/4.2/public/index.php | 4 ++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/symfony/framework-bundle/3.3/post-install.txt b/symfony/framework-bundle/3.3/post-install.txt index 6aaefd13..63d5e10c 100644 --- a/symfony/framework-bundle/3.3/post-install.txt +++ b/symfony/framework-bundle/3.3/post-install.txt @@ -5,7 +5,7 @@ * Run your application: 1. Change to the project directory 2. Create your code repository with the git init command - 3. Execute the php -S 127.0.0.1:8000 -t public command + 3. Execute the php -S 127.0.0.1:8000 -t public public/index.php command 4. Browse to the http://localhost:8000/ URL. Quit the server with CTRL-C. diff --git a/symfony/framework-bundle/3.3/public/index.php b/symfony/framework-bundle/3.3/public/index.php index 5283b7ce..7e5d9e9b 100644 --- a/symfony/framework-bundle/3.3/public/index.php +++ b/symfony/framework-bundle/3.3/public/index.php @@ -19,6 +19,10 @@ $env = $_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? 'dev'; $debug = (bool) ($_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? ('prod' !== $env)); if ($debug) { + // Compatibility with the built-in PHP web server + if ('/index.php' !== $_SERVER['SCRIPT_NAME'] && is_file(__DIR__.$_SERVER['SCRIPT_NAME'])) { + return false; + } umask(0000); Debug::enable(); diff --git a/symfony/framework-bundle/4.2/post-install.txt b/symfony/framework-bundle/4.2/post-install.txt index 6aaefd13..63d5e10c 100644 --- a/symfony/framework-bundle/4.2/post-install.txt +++ b/symfony/framework-bundle/4.2/post-install.txt @@ -5,7 +5,7 @@ * Run your application: 1. Change to the project directory 2. Create your code repository with the git init command - 3. Execute the php -S 127.0.0.1:8000 -t public command + 3. Execute the php -S 127.0.0.1:8000 -t public public/index.php command 4. Browse to the http://localhost:8000/ URL. Quit the server with CTRL-C. diff --git a/symfony/framework-bundle/4.2/public/index.php b/symfony/framework-bundle/4.2/public/index.php index bdcf5f4d..6a6b9202 100644 --- a/symfony/framework-bundle/4.2/public/index.php +++ b/symfony/framework-bundle/4.2/public/index.php @@ -19,6 +19,10 @@ $env = $_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? 'dev'; $debug = (bool) ($_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? ('prod' !== $env)); if ($debug) { + // Compatibility with the built-in PHP web server + if ('/index.php' !== $_SERVER['SCRIPT_NAME'] && is_file(__DIR__.$_SERVER['SCRIPT_NAME'])) { + return false; + } umask(0000); Debug::enable();