From f86d3e76367ac1f6800ca62e9e23fb293cb8fc11 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Thu, 13 Nov 2014 16:35:26 +0100 Subject: [PATCH] Web\StyleSheet: PCRE problem workaround, PHP5.3.7 Lines with embedded fonts where too long for lessphp's PCRE matches unless PHP 5.3.7 --- library/Icinga/Web/StyleSheet.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/library/Icinga/Web/StyleSheet.php b/library/Icinga/Web/StyleSheet.php index 53415628c..ec926d992 100644 --- a/library/Icinga/Web/StyleSheet.php +++ b/library/Icinga/Web/StyleSheet.php @@ -31,6 +31,7 @@ class StyleSheet public static function compileForPdf() { + self::checkPhp(); $less = new LessCompiler(); $basedir = Icinga::app()->getBootstrapDirectory(); foreach (self::$lessFiles as $file) { @@ -55,8 +56,17 @@ class StyleSheet ); } + protected static function checkPhp() + { + // PHP had a rather conservative PCRE backtrack limit unless 5.3.7 + if (version_compare(PHP_VERSION, '5.3.7') <= 0) { + ini_set('pcre.backtrack_limit', 1000000); + } + } + public static function send($minified = false) { + self::checkPhp(); $app = Icinga::app(); $basedir = $app->getBootstrapDirectory(); foreach (self::$lessFiles as $file) {