Skip to content

Commit

Permalink
Merge branch '4.4' into 5.3
Browse files Browse the repository at this point in the history
* 4.4:
  Remove polyfills from Yaml and Dotenv
  • Loading branch information
fabpot committed Jul 29, 2021
2 parents f0fcb34 + 2b078ef commit b6d4466
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
10 changes: 5 additions & 5 deletions Dotenv.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public function populate(array $values, bool $overrideExistingVars = false): voi
$loadedVars = array_flip(explode(',', $_SERVER['SYMFONY_DOTENV_VARS'] ?? $_ENV['SYMFONY_DOTENV_VARS'] ?? ''));

foreach ($values as $name => $value) {
$notHttpName = !str_starts_with($name, 'HTTP_');
$notHttpName = 0 !== strpos($name, 'HTTP_');
// don't check existence with getenv() because of thread safety issues
if (!isset($loadedVars[$name]) && (!$overrideExistingVars && (isset($_ENV[$name]) || (isset($_SERVER[$name]) && $notHttpName)))) {
continue;
Expand Down Expand Up @@ -427,7 +427,7 @@ private function skipEmptyLines()

private function resolveCommands(string $value, array $loadedVars): string
{
if (!str_contains($value, '$')) {
if (false === strpos($value, '$')) {
return $value;
}

Expand Down Expand Up @@ -463,7 +463,7 @@ private function resolveCommands(string $value, array $loadedVars): string

$env = [];
foreach ($this->values as $name => $value) {
if (isset($loadedVars[$name]) || (!isset($_ENV[$name]) && !(isset($_SERVER[$name]) && !str_starts_with($name, 'HTTP_')))) {
if (isset($loadedVars[$name]) || (!isset($_ENV[$name]) && !(isset($_SERVER[$name]) && 0 !== strpos($name, 'HTTP_')))) {
$env[$name] = $value;
}
}
Expand All @@ -481,7 +481,7 @@ private function resolveCommands(string $value, array $loadedVars): string

private function resolveVariables(string $value, array $loadedVars): string
{
if (!str_contains($value, '$')) {
if (false === strpos($value, '$')) {
return $value;
}

Expand Down Expand Up @@ -516,7 +516,7 @@ private function resolveVariables(string $value, array $loadedVars): string
$value = $this->values[$name];
} elseif (isset($_ENV[$name])) {
$value = $_ENV[$name];
} elseif (isset($_SERVER[$name]) && !str_starts_with($name, 'HTTP_')) {
} elseif (isset($_SERVER[$name]) && 0 !== strpos($name, 'HTTP_')) {
$value = $_SERVER[$name];
} elseif (isset($this->values[$name])) {
$value = $this->values[$name];
Expand Down
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
],
"require": {
"php": ">=7.2.5",
"symfony/deprecation-contracts": "^2.1",
"symfony/polyfill-php80": "^1.16"
"symfony/deprecation-contracts": "^2.1"
},
"require-dev": {
"symfony/process": "^4.4|^5.0"
Expand Down

0 comments on commit b6d4466

Please sign in to comment.