Skip to content

Commit 8331da8

Browse files
Merge branch '4.4' into 5.0
* 4.4: [Debug] fix ClassNotFoundFatalErrorHandler [Routing] Fix using a custom matcher & generator dumper class [Serializer] Fix cache in MetadataAwareNameConverter [Dotenv] Fixed infinite loop with missing quote followed by quoted value [HttpClient] Added missing sprintf [TwigBridge] button_widget now has its title attr translated even if its label = null or false [PhpUnitBridge] When using phpenv + phpenv-composer plugin, composer executable is wrapped into a bash script [Messenger] Added check if json_encode succeeded [Messenger] Added check if json_encode succeeded [FrameworkBundle][ContainerLintCommand] Only skip .errored. services [HttpClient] fix exception in case of PSR17 discovery failure [DependencyInjection] Handle ServiceClosureArgument for callable in container linting fix processing chain adapter based cache pool [HttpKernel] release lock explicitly [Security] Prevent canceled remember-me cookie from being accepted [FrameworkBundle][TranslationUpdateCommand] Do not output positive feedback on stderr [Security\Guard] Fix missing typehints do not render preferred choices as selected
2 parents 3183780 + b74a163 commit 8331da8

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Dotenv.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,10 @@ private function lexValue(): string
272272
$this->cursor += 1 + $len;
273273
} elseif ('"' === $this->data[$this->cursor]) {
274274
$value = '';
275-
++$this->cursor;
275+
276+
if (++$this->cursor === $this->end) {
277+
throw $this->createFormatException('Missing quote to end the value');
278+
}
276279

277280
while ('"' !== $this->data[$this->cursor] || ('\\' === $this->data[$this->cursor - 1] && '\\' !== $this->data[$this->cursor - 2])) {
278281
$value .= $this->data[$this->cursor];

Tests/DotenvTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public function getEnvDataWithFormatErrors()
4040
['FOO', "Missing = in the environment variable declaration in \".env\" at line 1.\n...FOO...\n ^ line 1 offset 3"],
4141
['FOO="foo', "Missing quote to end the value in \".env\" at line 1.\n...FOO=\"foo...\n ^ line 1 offset 8"],
4242
['FOO=\'foo', "Missing quote to end the value in \".env\" at line 1.\n...FOO='foo...\n ^ line 1 offset 8"],
43+
["FOO=\"foo\nBAR=\"bar\"", "Missing quote to end the value in \".env\" at line 1.\n...FOO=\"foo\\nBAR=\"bar\"...\n ^ line 1 offset 18"],
4344
['FOO=\'foo'."\n", "Missing quote to end the value in \".env\" at line 1.\n...FOO='foo\\n...\n ^ line 1 offset 9"],
4445
['export FOO', "Unable to unset an environment variable in \".env\" at line 1.\n...export FOO...\n ^ line 1 offset 10"],
4546
['FOO=${FOO', "Unclosed braces on variable expansion in \".env\" at line 1.\n...FOO=\${FOO...\n ^ line 1 offset 9"],

0 commit comments

Comments
 (0)