summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-11-12 20:40:27 +0000
committerDries Buytaert <dries@buytaert.net>2009-11-12 20:40:27 +0000
commit9edcceb07ca10ca985a29f01ce4182dd2d9250f8 (patch)
tree5a27f7f342021e01fc71bc3b0b3c239bb185db2d
parent12ead3181968bbc5400fce69433a075514e6e8f5 (diff)
downloadbrdo-9edcceb07ca10ca985a29f01ce4182dd2d9250f8.tar.gz
brdo-9edcceb07ca10ca985a29f01ce4182dd2d9250f8.tar.bz2
- Patch #444228 by Tri, raulgigea, mikeytown2, JohnAlbin: optimize CSS option causes php cgi to segfault in pcre function 'match'.
-rw-r--r--includes/common.inc8
1 files changed, 6 insertions, 2 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 4f19a63b5..729e67652 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -3465,9 +3465,13 @@ function drupal_load_stylesheet_content($contents, $optimize = FALSE) {
if ($optimize) {
// Perform some safe CSS optimizations.
+ $contents = preg_replace('{
+ (?<=\\\\\*/)([^/\*]+/\*)([^\*/]+\*/) # Add a backslash also at the end ie-mac hack comment, so the next pass will not touch it.
+ # The added backshlash does not affect the effectiveness of the hack.
+ }x', '\1\\\\\2', $contents);
$contents = preg_replace('<
- \s*([@{}:;,]|\)\s|\s\()\s* | # Remove whitespace around separators, but keep space around parentheses.
- /\*([^*\\\\]|\*(?!/))+\*/ # Remove comments that are not CSS hacks.
+ \s*([@{}:;,]|\)\s|\s\()\s* | # Remove whitespace around separators, but keep space around parentheses.
+ /\*[^*\\\\]*\*+([^/*][^*]*\*+)*/ | # Remove comments that are not CSS hacks.
>x', '\1', $contents);
}