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

Skip to content

Commit 8b36baf

Browse files
bug #29205 [Dotenv] skip loading "local" env twice (nicolas-grekas)
This PR was merged into the 4.2-dev branch. Discussion ---------- [Dotenv] skip loading "local" env twice | Q | A | ------------- | --- | Branch? | 4.2 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - e.g. on homestead, APP_ENV defaults to "local" :) Commits ------- 978fcfb [Dotenv] skip loading "local" env twice
2 parents adb96f6 + 978fcfb commit 8b36baf

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Symfony/Component/Dotenv/Dotenv.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ public function loadEnv(string $path, string $varName = 'APP_ENV', string $defau
8282
$env = $_SERVER[$varName] ?? $_ENV[$varName] ?? $env;
8383
}
8484

85+
if ('local' === $env) {
86+
return;
87+
}
88+
8589
if (file_exists($p = "$path.$env")) {
8690
$this->load($p);
8791
}

0 commit comments

Comments
 (0)