Merge pull request #21120 from eileenmcnaughton/acl_setting
[civicrm-core.git] / CRM / Utils / JS.php
index 66c03e0f483d6175b3a8337723eb98d332cae5ed..dbb5644a0988be4b5e218231977216ced1760182 100644 (file)
@@ -109,6 +109,10 @@ class CRM_Utils_JS {
    * @return string
    */
   public static function stripComments($script) {
+    // This function is a little naive, and some expressions may trip it up. Opt-out if anything smells fishy.
+    if (preg_match(';`\r?\n//;', $script)) {
+      return $script;
+    }
     return preg_replace("#^\\s*//[^\n]*$(?:\r\n|\n)?#m", "", $script);
   }