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
This commit is contained in:
Thomas Gelf 2014-11-13 16:35:26 +01:00
parent c68f9502ea
commit f86d3e7636

View File

@ -31,6 +31,7 @@ class StyleSheet
public static function compileForPdf() public static function compileForPdf()
{ {
self::checkPhp();
$less = new LessCompiler(); $less = new LessCompiler();
$basedir = Icinga::app()->getBootstrapDirectory(); $basedir = Icinga::app()->getBootstrapDirectory();
foreach (self::$lessFiles as $file) { 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) public static function send($minified = false)
{ {
self::checkPhp();
$app = Icinga::app(); $app = Icinga::app();
$basedir = $app->getBootstrapDirectory(); $basedir = $app->getBootstrapDirectory();
foreach (self::$lessFiles as $file) { foreach (self::$lessFiles as $file) {