From 8c308fe9b74644bb01264d3cb68ec850edcd2481 Mon Sep 17 00:00:00 2001 From: Tom Vega Date: Fri, 5 May 2017 09:10:55 -0400 Subject: [PATCH] Fixed overquoting on quotes Will check if there is no quotes on start and end of value --- src/DotenvEditor.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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++;