Skip to content

Commit cede2cb

Browse files
committed
minor #696 Add a APP_DEBUG fallback in console and front controller (javiereguiluz)
This PR was squashed before being merged into the master branch (closes #696). Discussion ---------- Add a APP_DEBUG fallback in console and front controller This was recently changed in the official Symfony Flex recipes. See symfony/recipes#239 Commits ------- f9a3f6c Add a APP_DEBUG fallback in console and front controller
2 parents a3b4eae + f9a3f6c commit cede2cb

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

bin/console

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ if (!isset($_SERVER['APP_ENV'])) {
2121

2222
$input = new ArgvInput();
2323
$env = $input->getParameterOption(['--env', '-e'], $_SERVER['APP_ENV'] ?? 'dev');
24-
$debug = ($_SERVER['APP_DEBUG'] ?? true) !== '0' && !$input->hasParameterOption(['--no-debug', '']);
24+
$debug = ($_SERVER['APP_DEBUG'] ?? ('prod' !== $env)) && !$input->hasParameterOption(['--no-debug', '']);
2525

2626
if ($debug) {
2727
umask(0000);

public/index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
(new Dotenv())->load(__DIR__.'/../.env');
2222
}
2323

24-
if ($_SERVER['APP_DEBUG'] ?? false) {
24+
if ($_SERVER['APP_DEBUG'] ?? ('prod' !== ($_SERVER['APP_ENV'] ?? 'dev'))) {
2525
umask(0000);
2626

2727
Debug::enable();
2828
}
2929

3030
// Request::setTrustedProxies(['0.0.0.0/0'], Request::HEADER_FORWARDED);
3131

32-
$kernel = new Kernel($_SERVER['APP_ENV'] ?? 'dev', $_SERVER['APP_DEBUG'] ?? false);
32+
$kernel = new Kernel($_SERVER['APP_ENV'] ?? 'dev', $_SERVER['APP_DEBUG'] ?? ('prod' !== ($_SERVER['APP_ENV'] ?? 'dev')));
3333
$request = Request::createFromGlobals();
3434
$response = $kernel->handle($request);
3535
$response->send();

0 commit comments

Comments
 (0)