Skip to content

Commit a2650ca

Browse files
author
symfony-flex-server[bot]
authored
Merge pull request #734
2 parents 9d43eac + 27e6507 commit a2650ca

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

symfony/framework-bundle/3.3/config/bootstrap.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
require dirname(__DIR__).'/vendor/autoload.php';
66

7+
if (!class_exists(Dotenv::class)) {
8+
throw new LogicException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
9+
}
10+
711
// Load cached env vars if the .env.local.php file exists
812
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
9-
if (is_array($env = @include dirname(__DIR__).'/.env.local.php') && ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env['APP_ENV'] ?? null) === ($env['APP_ENV'] ?? null)) {
10-
foreach ($env as $k => $v) {
11-
$_ENV[$k] = $_ENV[$k] ?? (isset($_SERVER[$k]) && 0 !== strpos($k, 'HTTP_') ? $_SERVER[$k] : $v);
12-
}
13-
} elseif (!class_exists(Dotenv::class)) {
14-
throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
13+
if (is_array($env = @include dirname(__DIR__).'/.env.local.php') && (!isset($env['APP_ENV']) || ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env['APP_ENV']) === $env['APP_ENV'])) {
14+
(new Dotenv(false))->populate($env);
1515
} else {
1616
$path = dirname(__DIR__).'/.env';
1717
$dotenv = new Dotenv(false);

symfony/framework-bundle/4.2/config/bootstrap.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
require dirname(__DIR__).'/vendor/autoload.php';
66

7+
if (!class_exists(Dotenv::class)) {
8+
throw new LogicException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
9+
}
10+
711
// Load cached env vars if the .env.local.php file exists
812
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
913
if (is_array($env = @include dirname(__DIR__).'/.env.local.php') && (!isset($env['APP_ENV']) || ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env['APP_ENV']) === $env['APP_ENV'])) {
10-
foreach ($env as $k => $v) {
11-
$_ENV[$k] = $_ENV[$k] ?? (isset($_SERVER[$k]) && 0 !== strpos($k, 'HTTP_') ? $_SERVER[$k] : $v);
12-
}
13-
} elseif (!class_exists(Dotenv::class)) {
14-
throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
14+
(new Dotenv(false))->populate($env);
1515
} else {
1616
// load all the .env files
1717
(new Dotenv(false))->loadEnv(dirname(__DIR__).'/.env');

0 commit comments

Comments
 (0)