8000 [Dotenv] Invinite loop with missing quote · Issue #34642 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Dotenv] Invinite loop with missing quote #34642

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
stollr opened this issue Nov 26, 2019 · 1 comment
Closed

[Dotenv] Invinite loop with missing quote #34642

stollr opened this issue Nov 26, 2019 · 1 comment

Comments

@stollr
Copy link
stollr commented Nov 26, 2019

Symfony version(s) affected: v4.4.0

Description
A missing closing quote in a line leads to an infinite loop telling:

PHP Notice: Uninitialized string offset: 592 in /var/www/ecgpb-memberlist/vendor/symfony/dotenv/Dotenv.php on line 289
PHP Stack trace:
PHP 1. {main}() /var/www/ecgpb-memberlist/test.php:0
PHP 2. Symfony\Component\Dotenv\Dotenv->parse() /var/www/ecgpb-memberlist/test.php:11
PHP 3. Symfony\Component\Dotenv\Dotenv->lexValue() /var/www/ecgpb-memberlist/vendor/symfony/dotenv/Dotenv.php:200

How to reproduce
Try this code to reproduce:

require __DIR__.'/vendor/autoload.php';

$testString = 'FOO="x"
DOO="y
VOO="z"';

$dotenv = new \Symfony\Component\Dotenv\Dotenv();

$dotenv->parse($testString);

In the second line DOO="y is missing the closing quote at the end. But this shouldn't result in an infinite loop, but in a helpful error message.

@stollr
Copy link
Author
stollr commented Nov 26, 2019

Version 3.4 is also affected by this bug.

stollr pushed a commit to stollr/symfony that referenced this issue Nov 27, 2019
If there's a quote missing to end a value and in the next line there's again a quoted value Dotenv will run into an infinite loop. An .env file with the following content will result in this error:
```
FOO="foo
BAR="bar"
```
See symfony#34642 for more details.
stollr pushed a commit to stollr/symfony that referenced this issue Jan 7, 2020
If there's a quote missing to end a value and in the next line there's again a quoted value Dotenv will run into an infinite loop. An .env file with the following content will result in this error:
```
FOO="foo
BAR="bar"
```
See symfony#34642 for more details.
stollr pushed a commit to stollr/symfony that referenced this issue Jan 7, 2020
If there's a quote missing to end a value and in the next line there's again a quoted value Dotenv will run into an infinite loop. An .env file with the following content will result in this error:
```
FOO="foo
BAR="bar"
```
See symfony#34642 for more details.
nicolas-grekas added a commit that referenced this issue Jan 8, 2020
…y quoted value (naitsirch)

This PR was merged into the 3.4 branch.

Discussion
----------

[Dotenv] Fixed infinite loop with missing quote followed by quoted value

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #34642
| License       | MIT
| Doc PR        |

If there's a quote missing to end a value and in the next line there's again a quoted value Dotenv will run into an infinite loop. An .env file with the following content will result in this error:
```
FOO="foo
BAR="bar"
```
See #34642 for more details.

Commits
-------

eb69e13 [Dotenv] Fixed infinite loop with missing quote followed by quoted value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
0