1
0
Fork 0
mirror of synced 2024-10-03 19:53:33 +13:00

Merge pull request #4341 from megatank58/patch-1

fix: correctly handle `=` in .env
This commit is contained in:
Christy Jacob 2022-12-20 16:32:29 +05:30 committed by GitHub
commit 37ce513b87
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 2 deletions

View file

@ -19,7 +19,7 @@ class Env
$data = explode("\n", $data);
foreach ($data as &$row) {
$row = explode('=', $row);
$row = explode('=', $row, 2);
$key = (isset($row[0])) ? trim($row[0]) : null;
$value = (isset($row[1])) ? trim($row[1]) : null;

View file

@ -1,3 +1,4 @@
_APP_X=value1
_APP_Y=value2
_APP_Z = value3
_APP_Z = value3
_APP_W = value5=

View file

@ -28,6 +28,7 @@ class EnvTest extends TestCase
$this->assertEquals('value1', $this->object->getVar('_APP_X'));
$this->assertEquals('value2', $this->object->getVar('_APP_Y'));
$this->assertEquals('value3', $this->object->getVar('_APP_Z'));
$this->assertEquals('value5=', $this->object->getVar('_APP_W'));
$this->assertEquals('value4', $this->object->getVar('_APP_TEST'));
}