Skip to content

Commit

Permalink
Merge branch '5.4' into 6.0
Browse files Browse the repository at this point in the history
* 5.4: (21 commits)
  [Finder] Fix finding VCS re-included files in excluded directory
  [Yaml] Improve the deprecation warnings for octal numbers to suggest migrating
  Fix Choice constraint with associative choices array
  [Form] UrlType should not add protocol to emails
  [Dotenv] Fix bootEnv() override with .env.local.php when the env key already exists
  Silence isatty warnings during tty detection
  [Serializer] Fix AbstractObjectNormalizer not considering pseudo type false
  [Notifier] Fix encoding of messages with FreeMobileTransport
  [Cache] workaround PHP crash
  [Console] Fix PHP 8.1 deprecation in ChoiceQuestion
  [HttpKernel] Fix compatibility with php bridge and already started php sessions
  [Notifier] smsapi-notifier - correct encoding
  Replaced full CoC text with link to documentation
  Making the parser stateless
  [Console] fix restoring stty mode on CTRL+C
  fix merge (bis)
  fix merge
  [Process] Avoid calling fclose on an already closed resource
  [GHA] test tty group
  [DI] Fix tests on PHP 7.1
  ...
  • Loading branch information
nicolas-grekas committed Jan 26, 2022
2 parents 5496865 + 84d1af2 commit 45c47b6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dotenv.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function bootEnv(string $path, string $defaultEnv = 'dev', array $testEnv
$env = is_file($p) ? include $p : null;
$k = $this->envKey;

if (\is_array($env) && (!isset($env[$k]) || ($_SERVER[$k] ?? $_ENV[$k] ?? $env[$k]) === $env[$k])) {
if (\is_array($env) && ($overrideExistingVars || !isset($env[$k]) || ($_SERVER[$k] ?? $_ENV[$k] ?? $env[$k]) === $env[$k])) {
$this->populate($env, $overrideExistingVars);
} else {
$this->loadEnv($path, $k, $defaultEnv, $testEnvs, $overrideExistingVars);
Expand Down
7 changes: 7 additions & 0 deletions Tests/DotenvTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,13 @@ public function testBootEnv()
$this->assertSame('BAR', $_SERVER['FOO']);
$this->assertSame('1', $_SERVER['TEST_APP_DEBUG']);
$this->assertSame('localphpNEW_VALUE', $_SERVER['EXISTING_KEY']);

$resetContext();
$_SERVER['TEST_APP_ENV'] = 'ccc';
(new Dotenv('TEST_APP_ENV', 'TEST_APP_DEBUG'))->bootEnv($path, 'dev', ['test'], true);
$this->assertSame('BAR', $_SERVER['FOO']);
$this->assertSame('1', $_SERVER['TEST_APP_DEBUG']);
$this->assertSame('localphpNEW_VALUE', $_SERVER['EXISTING_KEY']);
unlink($path.'.local.php');

$resetContext();
Expand Down

0 comments on commit 45c47b6

Please sign in to comment.