From 984f441851117b6aab207c3c9b3b8ab75eea3c64 Mon Sep 17 00:00:00 2001 From: Mohamed Said Date: Tue, 23 Aug 2016 20:09:00 +0200 Subject: [PATCH] fix #45 --- src/Manager.php | 2 +- tests/ManagerTest.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Manager.php b/src/Manager.php index 09814d1..465b199 100644 --- a/src/Manager.php +++ b/src/Manager.php @@ -226,7 +226,7 @@ private function stringLineMaker($array, $prepend = '') $output .= "\n{$prepend} '{$key}' => [{$value}\n{$prepend} ],"; } else { - $value = addslashes($value); + $value = str_replace('\"', '"', addslashes($value)); $output .= "\n{$prepend} '{$key}' => '{$value}',"; } diff --git a/tests/ManagerTest.php b/tests/ManagerTest.php index 075b9e1..deac505 100644 --- a/tests/ManagerTest.php +++ b/tests/ManagerTest.php @@ -83,6 +83,8 @@ public function testWriteFile() $values = [ 'name' => ['first' => 'first', 'last' => ['last1' => '1', 'last2' => 2]], 'age' => 'age', + 'double_quotes' => '"with quotes"', + 'quotes' => "With some ' quotes", ]; $manager->writeFile($filePath, $values);