From 2047326d42e8242a63fd0d43889bd0d16ef8e283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Sat, 6 Oct 2018 13:21:29 +0200 Subject: [PATCH] Better fix --- symfony/framework-bundle/3.3/public/index.php | 8 ++++---- symfony/framework-bundle/4.2/public/index.php | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/symfony/framework-bundle/3.3/public/index.php b/symfony/framework-bundle/3.3/public/index.php index 7e5d9e9b..8856cb13 100644 --- a/symfony/framework-bundle/3.3/public/index.php +++ b/symfony/framework-bundle/3.3/public/index.php @@ -19,15 +19,15 @@ $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(); } +if (PHP_SAPI === 'cli-server' && '/index.php' !== $_SERVER['SCRIPT_NAME'] && is_file(__DIR__. $_SERVER['SCRIPT_NAME'])) { + return false; +} + if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) { Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST); } diff --git a/symfony/framework-bundle/4.2/public/index.php b/symfony/framework-bundle/4.2/public/index.php index 6a6b9202..81cc5e26 100644 --- a/symfony/framework-bundle/4.2/public/index.php +++ b/symfony/framework-bundle/4.2/public/index.php @@ -19,15 +19,15 @@ $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(); } +if (PHP_SAPI === 'cli-server' && '/index.php' !== $_SERVER['SCRIPT_NAME'] && is_file(__DIR__. $_SERVER['SCRIPT_NAME'])) { + return false; +} + if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) { Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST); }