Repository navigation
Conversation
…ues like MY_PASSWORD='3Pas$wdocker image history 45'
|
Does it not already parse properly without the slash? |
That addition looks incorrect, and won't stop it being treated like a variable, actually. |
|
with single quotes should not treat as a variable and just as plain text. it parses when you set like myVAR=3mypas$word, but raises that error when explicitly |
No, the variable replacement system doesn't care about the quotes you use. It is not like PHP strings. |
|
Resolving of nested variables is done after parsing, so adding an escape sequence, even in principle, won't work. |
|
Simply never try to escape dollars, and you will always get the string literal you want. I'm going to open a new issue to address if we want to forbid variable evaluation in single quoted strings and/or add a way to prevent variable evaluation from happening. |
|
This would be a breaking change though, so would require a new major version. |
|
NB, the way docker escape dollars is with a double dollar sign. Maybe that is the way to go? |
|
@rsalimian BTW, phpdotenv only actually expands environment variables that are quoted, so you should definitely write: |
|
thank you for having it in V4 RFC. this is my scenario is, in docker stack service definition |
Parser raises a fatal error if env value contains a dollar sign escaping like '3mypas$word'.
added the dollar sign to escaping list at the case ESCAPE_STATE fixed the issue.
Fatal error: Uncaught Dotenv\Exception\InvalidFileException: Failed to parse dotenv file due to an unexpected escape sequence. Failed at ['3mypas\$word'].