Skip to content

Commit

Permalink
Merge pull request #35 from VegaTom/#32
Browse files Browse the repository at this point in the history
Fixed overquoting on quotes
  • Loading branch information
Brotzka authored May 7, 2017
2 parents 612320c + 8c308fe commit d10926b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/DotenvEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down

0 comments on commit d10926b

Please sign in to comment.