another attempt; make Logger friend to php 5.3
[plcapi.git] / src / Helper / Logger.php
index 0bf6a20..85353eb 100644 (file)
@@ -36,7 +36,14 @@ class Logger
         }
 
         if (PHP_SAPI != 'cli') {
-            $flags = ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE;
+            $flags = ENT_COMPAT;
+            // avoid warnings on php < 5.4...
+            if (defined('ENT_HTML401')) {
+                $flags =  $flags | ENT_HTML401;
+            }
+            if (defined('ENT_SUBSTITUTE')) {
+                $flags =  $flags | ENT_SUBSTITUTE;
+            }
             if ($encoding != null) {
                 print "<PRE>\n".htmlentities($message, $flags, $encoding)."\n</PRE>";
             } else {
@@ -49,4 +56,4 @@ class Logger
         // let the user see this now in case there's a time out later...
         flush();
     }
-}
\ No newline at end of file
+}