Merge pull request #21120 from eileenmcnaughton/acl_setting
[civicrm-core.git] / CRM / Utils / JS.php
index da228d24136a30c4057f2a8468f324a55e946824..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);
   }
 
@@ -152,6 +156,7 @@ class CRM_Utils_JS {
 
   /**
    * @param string $str
+   * @param bool $throwException
    * @return string|null
    * @throws CRM_Core_Exception
    */