File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,10 @@ public function writeToEnvironment(array $values = [])
3030 $ saveContents = file_get_contents ($ path );
3131 collect ($ values )->each (function ($ value , $ key ) use (&$ saveContents ) {
3232 $ key = strtoupper ($ key );
33- if (str_contains ($ value , ' ' ) && ! preg_match ('/\"(.*)\"/ ' , $ value )) {
33+ // If the key value is not sorrounded by quotation marks, and contains anything that could reasonably
34+ // cause environment parsing issues, wrap it in quotes before writing it. This also adds slashes to the
35+ // value to ensure quotes within it don't cause us issues.
36+ if (! preg_match ('/^\"(.*)\"$/ ' , $ value ) && preg_match ('/([^\w.\-+\/])+/ ' , $ value )) {
3437 $ value = sprintf ('"%s" ' , addslashes ($ value ));
3538 }
3639
You can’t perform that action at this time.
0 commit comments