File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -246,6 +246,11 @@ protected function sanitiseVariableValue($name, $value)
246
246
$ parts = explode (' # ' , $ value , 2 );
247
247
$ value = trim ($ parts [0 ]);
248
248
249
+ // Check if value is a comment (usually triggered when empty value with comment)
250
+ if (preg_match ('/^#/ ' , $ value ) > 0 ) {
251
+ $ value = '' ;
252
+ }
253
+
249
254
// Unquoted values cannot contain whitespace
250
255
if (preg_match ('/\s+/ ' , $ value ) > 0 ) {
251
256
throw new InvalidFileException ('Dotenv values containing spaces must be surrounded by quotes. ' );
Original file line number Diff line number Diff line change 5
5
CSPACED = "with spaces" # this is a comment
6
6
CQUOTES = "a value with a # character" # this is a comment
7
7
CQUOTESWITHQUOTE = "a value with a # character & a quote \" character inside quotes" # " this is a comment
8
+ EMPTY = # comment with empty variable
9
+ BOOLEAN = yes # (yes, no)
8
10
9
11
CNULL =
10
12
You can’t perform that action at this time.
0 commit comments