Skip to content

[Dotenv] Handle dynamic variables in multiple .env files #48636

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: 7.4
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Applied coding standard patch
  • Loading branch information
valx76 committed Dec 14, 2022
commit 8d9ca1af6f574bb92d5ce74d19279d953689ca03
12 changes: 6 additions & 6 deletions src/Symfony/Component/Dotenv/Dotenv.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,9 @@ public function populate(array $values, bool $overrideExistingVars = false): voi
/**
* Parses the contents of an .env file.
*
* @param string $data The data to be parsed
* @param string $path The original file name where data where stored (used for more meaningful error messages)
* @param bool $needsValueResolution true when the value resolution needs to be done automatically
* @param string $data The data to be parsed
* @param string $path The original file name where data where stored (used for more meaningful error messages)
* @param bool $needsValueResolution true when the value resolution needs to be done automatically
*
* @throws FormatException when a file has a syntax error
*/
Expand Down Expand Up @@ -369,7 +369,7 @@ private function lexValue(bool $needsValueResolution): string
if ($needsValueResolution) {
$resolvedValue = $this->resolveVariables($resolvedValue, $loadedVars);
}

$resolvedValue = $this->resolveCommands($resolvedValue, $loadedVars);
$resolvedValue = str_replace('\\\\', '\\', $resolvedValue);
$v .= $resolvedValue;
Expand All @@ -396,7 +396,7 @@ private function lexValue(bool $needsValueResolution): string
if ($needsValueResolution) {
$resolvedValue = $this->resolveVariables($resolvedValue, $loadedVars);
}

$resolvedValue = $this->resolveCommands($resolvedValue, $loadedVars);
$resolvedValue = str_replace('\\\\', '\\', $resolvedValue);

Expand Down Expand Up @@ -596,7 +596,7 @@ private function resolveAllVariables(): void
unset($loadedVars['']);

foreach ($_ENV as $name => $value) {
if ($name === 'SYMFONY_DOTENV_VARS') {
if ('SYMFONY_DOTENV_VARS' === $name) {
continue;
}

Expand Down