diff --git a/src/DotenvEditor.php b/src/DotenvEditor.php index 5d1665d..d2f8094 100644 --- a/src/DotenvEditor.php +++ b/src/DotenvEditor.php @@ -389,9 +389,9 @@ protected function save($array) $newArray = array(); $c = 0; foreach($array as $key => $value){ - if (preg_match('/\s/', $value) > 0) { - $value = '"' . $value . '"'; - } + if (preg_match('/\s/', $value) > 0 && (strpos($value, '"') > 0 && strpos($value, '"', -0) > 0)) { + $value = '"' . $value . '"'; + } $newArray[$c] = $key . "=" . $value; $c++;