Skip to content

Commit a70ff4b

Browse files
committed
minor #599 Add forward compat with Dotenv v5.1 (nicolas-grekas)
This PR was merged into the 1.5-dev branch. Discussion ---------- Add forward compat with Dotenv v5.1 Sidekick of symfony/symfony#35308 Commits ------- 1bf83d4 Add forward compat with Dotenv v5.1
2 parents c497c0c + 1bf83d4 commit a70ff4b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Command/DumpEnvCommand.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,11 @@ private function loadEnv(string $path, string $env): array
8484
putenv('SYMFONY_DOTENV_VARS='.$_SERVER['SYMFONY_DOTENV_VARS']);
8585

8686
try {
87-
$dotenv = new Dotenv(false);
87+
if (method_exists(Dotenv::class, 'usePutenv')) {
88+
$dotenv = new Dotenv();
89+
} else {
90+
$dotenv = new Dotenv(false);
91+
}
8892

8993
if (method_exists($dotenv, 'loadEnv')) {
9094
$dotenv->loadEnv($path);

0 commit comments

Comments
 (0)