From: Giovanni Gargani Date: Fri, 9 Sep 2016 22:36:09 +0000 (+0200) Subject: CRM-18199 CRM_Utils_File::sourceSQLFile too greedy X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2e5eac5627fb6611b6a04750edee0251cb16b8b7;p=civicrm-core.git CRM-18199 CRM_Utils_File::sourceSQLFile too greedy Refactored the 2 comemnt stripping regexp in just one and fixed the greedyness --- diff --git a/CRM/Utils/File.php b/CRM/Utils/File.php index 485280bd74..64528a3855 100644 --- a/CRM/Utils/File.php +++ b/CRM/Utils/File.php @@ -324,8 +324,7 @@ class CRM_Utils_File { // get rid of comments starting with # and -- - $string = preg_replace("/^#[^\n]*$/m", "\n", $string); - $string = preg_replace("/^(--[^-]).*/m", "\n", $string); + $string = preg_replace("/^(#|--)[^\R]*$/m", "", $string); $queries = preg_split('/;\s*$/m', $string); foreach ($queries as $query) {