diff --git a/src/Symfony/Component/Dotenv/Command/DotenvDumpCommand.php b/src/Symfony/Component/Dotenv/Command/DotenvDumpCommand.php index beec6035a89a7..cd0fb5d185960 100644 --- a/src/Symfony/Component/Dotenv/Command/DotenvDumpCommand.php +++ b/src/Symfony/Component/Dotenv/Command/DotenvDumpCommand.php @@ -95,10 +95,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int private function loadEnv(string $dotenvPath, string $env, array $config): array { - $dotenv = new Dotenv(); $envKey = $config['env_var_name'] ?? 'APP_ENV'; $testEnvs = $config['test_envs'] ?? ['test']; + $dotenv = new Dotenv($envKey); + $globalsBackup = [$_SERVER, $_ENV]; unset($_SERVER[$envKey]); $_ENV = [$envKey => $env];