From 65dc172421cd7c70e8e46759c02b69faa41a95b4 Mon Sep 17 00:00:00 2001 From: Ben Davies Date: Fri, 14 Jun 2019 14:53:18 +0100 Subject: [PATCH] ensure is contains real env vars from , or defaults from .env.local.php --- symfony/framework-bundle/3.3/config/bootstrap.php | 4 +++- symfony/framework-bundle/4.2/config/bootstrap.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/symfony/framework-bundle/3.3/config/bootstrap.php b/symfony/framework-bundle/3.3/config/bootstrap.php index 25e44597..beb52ca2 100644 --- a/symfony/framework-bundle/3.3/config/bootstrap.php +++ b/symfony/framework-bundle/3.3/config/bootstrap.php @@ -7,7 +7,9 @@ require dirname(__DIR__).'/vendor/autoload.php'; // Load cached env vars if the .env.local.php file exists // Run "composer dump-env prod" to create it (requires symfony/flex >=1.2) if (is_array($env = @include dirname(__DIR__).'/.env.local.php')) { - $_ENV += $env; + foreach ($env as $k => $v) { + $_ENV[$k] = $_ENV[$k] ?? (isset($_SERVER[$k]) && 0 !== strpos($k, 'HTTP_') ? $_SERVER[$k] : $v); + } } elseif (!class_exists(Dotenv::class)) { throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.'); } else { diff --git a/symfony/framework-bundle/4.2/config/bootstrap.php b/symfony/framework-bundle/4.2/config/bootstrap.php index 570bb924..9c5a99c6 100644 --- a/symfony/framework-bundle/4.2/config/bootstrap.php +++ b/symfony/framework-bundle/4.2/config/bootstrap.php @@ -7,7 +7,9 @@ require dirname(__DIR__).'/vendor/autoload.php'; // Load cached env vars if the .env.local.php file exists // Run "composer dump-env prod" to create it (requires symfony/flex >=1.2) if (is_array($env = @include dirname(__DIR__).'/.env.local.php')) { - $_ENV += $env; + foreach ($env as $k => $v) { + $_ENV[$k] = $_ENV[$k] ?? (isset($_SERVER[$k]) && 0 !== strpos($k, 'HTTP_') ? $_SERVER[$k] : $v); + } } elseif (!class_exists(Dotenv::class)) { throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.'); } else {