diff --git a/src/Util/Configuration.php b/src/Util/Configuration.php index d86b60f76ce..4fe768fdb6f 100644 --- a/src/Util/Configuration.php +++ b/src/Util/Configuration.php @@ -590,6 +590,8 @@ public function handlePHPConfiguration(): void \putenv("{$name}={$value}"); } + $value = \getenv($name); + if (!isset($_ENV[$name])) { $_ENV[$name] = $value; } diff --git a/tests/Util/ConfigurationTest.php b/tests/Util/ConfigurationTest.php index dcccfd8e210..7019f85b238 100644 --- a/tests/Util/ConfigurationTest.php +++ b/tests/Util/ConfigurationTest.php @@ -351,8 +351,8 @@ public function testPHPConfigurationIsHandledCorrectly(): void $this->assertFalse(\FOO); $this->assertTrue(\BAR); $this->assertFalse($GLOBALS['foo']); - $this->assertTrue($_ENV['foo']); - $this->assertEquals('forced', \getenv('foo_force')); + $this->assertTrue((bool) $_ENV['foo']); + $this->assertEquals(1, \getenv('foo')); $this->assertEquals('bar', $_POST['foo']); $this->assertEquals('bar', $_GET['foo']); $this->assertEquals('bar', $_COOKIE['foo']); @@ -399,7 +399,7 @@ public function testHandlePHPConfigurationDoesNotOverriteVariablesFromPutEnv(): \putenv('foo=putenv'); $this->configuration->handlePHPConfiguration(); - $this->assertTrue($_ENV['foo']); + $this->assertEquals('putenv', $_ENV['foo']); $this->assertEquals('putenv', \getenv('foo')); }