From f7d9b050b3aa477373657367a7c8a4bd0a794453 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Fri, 26 Jun 2015 14:34:10 +0100 Subject: [PATCH] Don't consider adding commas to comment lines As the comma won't be at the end, but in the middle and adding one to the end causes PHP issues --- lib/updater.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/updater.php b/lib/updater.php index cbec434..4c4ff28 100644 --- a/lib/updater.php +++ b/lib/updater.php @@ -178,8 +178,8 @@ 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) != ",") { + // 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), and doesn't contain a comment, add one + if ($i != count($newSettingsArray)-1 && substr(rtrim($contentLine),-1) != "," && strpos($contentLine,"//") == -1) { $contentLine = str_replace(PHP_EOL,",".PHP_EOL,$contentLine); } }