Skip to content
Snippets Groups Projects
Commit 40c833c2 authored by jurgenhaas's avatar jurgenhaas
Browse files

composer/plugin/drupal-environment#10 Replace $_ENV with getenv()

parent ee34a87c
No related branches found
No related tags found
1 merge request!5Merging develop into main
Pipeline #733939 passed
......@@ -94,8 +94,8 @@ final class Dotenv {
*/
public function receiveGlobal(string $key, string $prompt, string $default = ''): string {
$key = strtoupper($key);
$value = $_ENV[$key] ?? NULL;
if ($value === NULL) {
$value = getenv($key);
if ($value === FALSE) {
if (!empty($prompt) && $this->io->isInteractive()) {
$value = $this->io->ask($prompt . ': ');
}
......@@ -205,8 +205,8 @@ final class Dotenv {
*/
private function replaceItemEnvironmentVariables(string $item, array $matches): string {
foreach ($matches as $var) {
$value = $_ENV[$var] ?? NULL;
if ($value === NULL) {
$value = getenv($var);
if ($value === FALSE) {
$value = '';
}
$item = str_replace('{$env:' . $var . '}', $value, $item);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment