Skip to content

Commit 15506e0

Browse files
committed
Work out values for env and debug once
Previously the null coalescing logic was duplicated, this puts it into one place.
1 parent fc9b47d commit 15506e0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

symfony/framework-bundle/3.3/public/index.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
(new Dotenv())->load(__DIR__.'/../.env');
1616
}
1717

18-
if ($_SERVER['APP_DEBUG'] ?? ('prod' !== ($_SERVER['APP_ENV'] ?? 'dev'))) {
18+
$env = $_SERVER['APP_ENV'] ?? 'dev';
19+
$debug = $_SERVER['APP_DEBUG'] ?? ('prod' !== $env);
20+
21+
if ($debug) {
1922
umask(0000);
2023

2124
Debug::enable();
@@ -29,7 +32,7 @@
2932
Request::setTrustedHosts(explode(',', $trustedHosts));
3033
}
3134

32-
$kernel = new Kernel($_SERVER['APP_ENV'] ?? 'dev', $_SERVER['APP_DEBUG'] ?? ('prod' !== ($_SERVER['APP_ENV'] ?? 'dev')));
35+
$kernel = new Kernel($env, $debug);
3336
$request = Request::createFromGlobals();
3437
$response = $kernel->handle($request);
3538
$response->send();

0 commit comments

Comments
 (0)