Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Illuminate/Support/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Dotenv\Environment\DotenvFactory;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Support\HigherOrderTapProxy;
use Dotenv\Environment\Adapter\PutenvAdapter;
use Dotenv\Environment\Adapter\EnvConstAdapter;
use Dotenv\Environment\Adapter\ServerConstAdapter;

Expand Down Expand Up @@ -642,7 +643,7 @@ function env($key, $default = null)
static $variables;

if ($variables === null) {
$variables = (new DotenvFactory([new EnvConstAdapter, new ServerConstAdapter]))->createImmutable();
$variables = (new DotenvFactory([new EnvConstAdapter, new PutEnvAdapter, new ServerConstAdapter]))->createImmutable();
}

return Option::fromValue($variables->get($key))
Expand Down
3 changes: 3 additions & 0 deletions tests/Foundation/Bootstrap/LoadEnvironmentVariablesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ public function testCanLoad()
(new LoadEnvironmentVariables)->bootstrap($this->getAppMock('.env'));

$this->assertSame('BAR', env('FOO'));
$this->assertSame('BAR', getenv('FOO'));
$this->assertSame('BAR', $_ENV['FOO']);
$this->assertSame('BAR', $_SERVER['FOO']);
}

public function testCanFailSilent()
Expand Down