diff --git a/Dotenv.php b/Dotenv.php index 09e847c..57128b4 100644 --- a/Dotenv.php +++ b/Dotenv.php @@ -135,7 +135,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; @@ -372,7 +372,7 @@ private function skipEmptyLines() private function resolveCommands(string $value, array $loadedVars): string { - if (!str_contains($value, '$')) { + if (false === strpos($value, '$')) { return $value; } @@ -408,7 +408,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; } } @@ -426,7 +426,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; } @@ -461,7 +461,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]; diff --git a/composer.json b/composer.json index 037d039..a6f7fdd 100644 --- a/composer.json +++ b/composer.json @@ -16,8 +16,7 @@ } ], "require": { - "php": ">=7.1.3", - "symfony/polyfill-php80": "^1.16" + "php": ">=7.1.3" }, "require-dev": { "symfony/process": "^3.4.2|^4.0|^5.0"