Skip to content

Commit

Permalink
minor #696 Add a APP_DEBUG fallback in console and front controller (…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
javiereguiluz committed Nov 10, 2017
2 parents a3b4eae + f9a3f6c commit cede2cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bin/console
Expand Up @@ -21,7 +21,7 @@ if (!isset($_SERVER['APP_ENV'])) {

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

if ($debug) {
umask(0000);
Expand Down
4 changes: 2 additions & 2 deletions public/index.php
Expand Up @@ -21,15 +21,15 @@
(new Dotenv())->load(__DIR__.'/../.env');
}

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

Debug::enable();
}

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

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

0 comments on commit cede2cb

Please sign in to comment.