We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6ac12fc commit b707147Copy full SHA for b707147
1 file changed
app/Traits/Commands/EnvironmentWriterTrait.php
@@ -30,7 +30,10 @@ public function writeToEnvironment(array $values = [])
30
$saveContents = file_get_contents($path);
31
collect($values)->each(function ($value, $key) use (&$saveContents) {
32
$key = strtoupper($key);
33
- if (str_contains($value, ' ') && ! preg_match('/\"(.*)\"/', $value)) {
+ // 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)) {
37
$value = sprintf('"%s"', addslashes($value));
38
}
39
0 commit comments