dev/core#3160 fix inability to import 'just contactid' and add to group
[civicrm-core.git] / CRM / Utils / JS.php
index 66c03e0f483d6175b3a8337723eb98d332cae5ed..27c4d4524525724a1d52b16eb9941e8da45d9b60 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);
   }
 
@@ -214,7 +218,7 @@ class CRM_Utils_JS {
    *   'bar' => 'function() {return "bar";}',
    * ]
    *
-   * @param $js
+   * @param string $js
    * @return array
    * @throws Exception
    */