Fix "CSSMin url() value remapping not working in certain obscure cases"
[lhc/web/wiklou.git] / includes / libs / CSSMin.php
index 10277e6..605e094 100644 (file)
@@ -203,11 +203,12 @@ class CSSMin {
                        $remote = substr( $remote, 0, -1 );
                }
 
-               // Note: This will not correctly handle cases where ';', '{' or '}'
-               // appears in the rule itself, e.g. in a quoted string. You are advised
+               // Note: This will correctly handle cases where ';', '{' or '}' appears
+               // in a css block comment (/* ... */). All other occurrences, e.g. in
+               // quoted strings, will not be handled correctly. You are advised
                // not to use such characters in file names. We also match start/end of
                // the string to be consistent in edge-cases ('@import url(…)').
-               $pattern = '/(?:^|[;{])\K[^;{}]*' . CSSMin::URL_REGEX . '[^;}]*(?=[;}]|$)/';
+               $pattern = '/(?:^|[;{])\K(?:\/\*.*?\*\/|[^;{}])*' . CSSMin::URL_REGEX . '(?:\/\*.*?\*\/|[^;}])*(?=[;}]|$)/';
 
                return preg_replace_callback(
                        $pattern,