Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Runtime] fix defining APP_DEBUG when Dotenv is not enabled #43945

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[Runtime] fix defining APP_DEBUG when Dotenv is not enabled
  • Loading branch information
nicolas-grekas committed Nov 5, 2021
commit 189987ab596da3e97b51e40f3c2e1f7493fd5d02
3 changes: 2 additions & 1 deletion src/Symfony/Component/Runtime/SymfonyRuntime.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ public function __construct(array $options = [])
$options['debug'] ?? $options['debug'] = '1' === $_SERVER['APP_DEBUG'];
$options['disable_dotenv'] = true;
} else {
$_SERVER['APP_ENV'] ?? $_SERVER['APP_ENV'] = 'dev';
$_SERVER['APP_ENV'] ?? $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] ?? 'dev';
$_SERVER['APP_DEBUG'] ?? $_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] ?? !\in_array($_SERVER['APP_ENV'], (array) ($options['prod_envs'] ?? ['prod']), true);
}

$options['error_handler'] ?? $options['error_handler'] = SymfonyErrorHandler::class;
Expand Down