Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Parser/EntryParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private static function splitStringIntoParts(string $line)
*/
private static function parseName(string $name)
{
if (Str::len($name) > 8 && Str::substr($name, 0, 6) === 'export' && \ctype_space(Str::substr($name, 6, 1))) {
if (Str::substr($name, 0, 6) === 'export' && \ctype_space(Str::substr($name, 6, 1))) {
$name = \ltrim(Str::substr($name, 6), " \t\n\r\v\f");
}

Expand Down
1 change: 1 addition & 0 deletions tests/Dotenv/DotenvTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ public function testExportedDotenvLoadsEnvironmentVars()
self::assertSame('with spaces', $_SERVER['ESPACED']);
self::assertSame('123', $_SERVER['EDQUOTED']);
self::assertSame('456', $_SERVER['ESQUOTED']);
self::assertSame('789', $_SERVER['E']);
self::assertEmpty($_SERVER['ENULL']);
}

Expand Down
12 changes: 12 additions & 0 deletions tests/Dotenv/Parser/EntryParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,18 @@ public function testExportParseTab()
$this->checkPositiveResult($result, 'FOO', 'bar baz');
}

public function testExportParseSingleCharName()
{
$result = EntryParser::parse('export A=1');
$this->checkPositiveResult($result, 'A', '1');
}

public function testExportParseNoWhitespace()
{
$result = EntryParser::parse('exportFOO=bar');
$this->checkPositiveResult($result, 'exportFOO', 'bar');
}

public function testExportParseFail()
{
$result = EntryParser::parse('export "FOO="bar baz"');
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/env/exported.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ export EBAR = "baz"
export ESPACED="with spaces"
export "EDQUOTED" = 123
export 'ESQUOTED' = 456
export E=789

export ENULL=""
Loading