Allow . in variables

This commit is contained in:
2021-10-14 13:36:50 +09:00
parent 75367b2724
commit 6cc09fb089
2 changed files with 3 additions and 1 deletions

View File

@@ -42,7 +42,7 @@ function readEnvFile(string $path = __DIR__, string $env_file = '.env'): int
$var = ''; $var = '';
while ($line = fgets($fp)) { while ($line = fgets($fp)) {
// main match for variable = value part // main match for variable = value part
if (preg_match("/^\s*([\w_]+)\s*=\s*((\"?).*)/", $line, $matches)) { if (preg_match("/^\s*([\w_.]+)\s*=\s*((\"?).*)/", $line, $matches)) {
$var = $matches[1]; $var = $matches[1];
$value = $matches[2]; $value = $matches[2];
$quotes = $matches[3]; $quotes = $matches[3];

View File

@@ -8,6 +8,8 @@ FAILURE = ABC
SIMPLEBOX= A B C SIMPLEBOX= A B C
TITLE=1 TITLE=1
FOO=1.2 FOO=1.2
SOME.TEST=Test Var
SOME.LIVE=Live Var
Test="A" Test="A"
TEST="B" TEST="B"
TEST="D" TEST="D"