From e8035c122c39a2a08b5d92afc1b7644e40d8e2bd Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Tue, 1 Jul 2014 14:17:24 +0100 Subject: [PATCH] Old settings that aren't last line end with comma --- lib/updater.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/updater.php b/lib/updater.php index c905426..11019f8 100644 --- a/lib/updater.php +++ b/lib/updater.php @@ -150,6 +150,10 @@ function transposeSettings($oldFile,$newFile,$saveFile) { // And override with old setting if not blank, not in excluded array and we have a match if ($thisKey != "" && $thisKey != "versionNo" && $thisKey != "codeMirrorDir" && strpos($oldSettingsArray[$j],'"'.$thisKey.'"') > -1) { $contentLine = $oldSettingsArray[$j].PHP_EOL; + // If the old setting we're copying over isn't replacing the last line and doesn't end in a comma (after an rtrim to remove line endings), add one + if ($i != count($newSettingsArray)-1 && substr(rtrim($contentLine),-1) != ",") { + $contentLine = str_replace(PHP_EOL,",".PHP_EOL,$contentLine); + } } } $contents .= $contentLine;