From 15506e0e3dd3427bac9a37bf67f1a6361a9b6474 Mon Sep 17 00:00:00 2001 From: Ben Scott Date: Wed, 20 Dec 2017 11:07:53 -0800 Subject: [PATCH] Work out values for env and debug once Previously the null coalescing logic was duplicated, this puts it into one place. --- symfony/framework-bundle/3.3/public/index.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/symfony/framework-bundle/3.3/public/index.php b/symfony/framework-bundle/3.3/public/index.php index 521b85d7..ab41c26e 100644 --- a/symfony/framework-bundle/3.3/public/index.php +++ b/symfony/framework-bundle/3.3/public/index.php @@ -15,7 +15,10 @@ if (!isset($_SERVER['APP_ENV'])) { (new Dotenv())->load(__DIR__.'/../.env'); } -if ($_SERVER['APP_DEBUG'] ?? ('prod' !== ($_SERVER['APP_ENV'] ?? 'dev'))) { +$env = $_SERVER['APP_ENV'] ?? 'dev'; +$debug = $_SERVER['APP_DEBUG'] ?? ('prod' !== $env); + +if ($debug) { umask(0000); Debug::enable(); @@ -29,7 +32,7 @@ if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) { Request::setTrustedHosts(explode(',', $trustedHosts)); } -$kernel = new Kernel($_SERVER['APP_ENV'] ?? 'dev', $_SERVER['APP_DEBUG'] ?? ('prod' !== ($_SERVER['APP_ENV'] ?? 'dev'))); +$kernel = new Kernel($env, $debug); $request = Request::createFromGlobals(); $response = $kernel->handle($request); $response->send();