Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Dotenv] properly parse backslashes in unquoted env vars#29222
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
xabbuh commentedNov 14, 2018
| Q | A |
|---|---|
| Branch? | 3.4 |
| Bug fix? | yes |
| New feature? | no |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | #29202 |
| License | MIT |
| Doc PR |
| ++$this->cursor; | ||
| } | ||
| $value =rtrim($value); | ||
| $value =str_replace('\\\\','\\',rtrim($value)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Not sure that's enough: egFOO=A\\$B should resolve toA\Foo whenB=Foo is set previoulsy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
you are right, and this also didn't work with double-quoted strings, both cases should be good now
| $regex ='/ | ||
| (\\\\)? # escaped with a backslash? | ||
| ((?:\\\\)?\\\\)? # escaped with a backslash? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thinking more about it this will probably not be enough as there could be an endless number of backslashes and we need to check whether we have an even or an odd number of them to decide whether or not the$ character is escaped.
cd30eb9 tod418826Compare
OskarStark left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Great work 👌🏻
fabpot commentedNov 24, 2018
Thank you@xabbuh. |
…xabbuh)This PR was merged into the 3.4 branch.Discussion----------[Dotenv] properly parse backslashes in unquoted env vars| Q | A| ------------- | ---| Branch? | 3.4| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#29202| License | MIT| Doc PR |Commits-------785fff5 properly parse backslashes in unquoted env vars