[icinga-checkins] icinga.org: icingaweb2/master: Web\StyleSheet: PCRE problem workaround, PHP5.3.7

git at icinga.org git at icinga.org
Thu Nov 13 16:36:57 CET 2014


Module: icingaweb2
Branch: master
Commit: f86d3e76367ac1f6800ca62e9e23fb293cb8fc11
URL:    https://git.icinga.org/?p=icingaweb2.git;a=commit;h=f86d3e76367ac1f6800ca62e9e23fb293cb8fc11

Author: Thomas Gelf <thomas at gelf.net>
Date:   Thu Nov 13 16:35:26 2014 +0100

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 5341562..ec926d9 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) {



More information about the icinga-checkins mailing list