Browse Source

Php5.3 autoload errors (#929)

* make ErrorHandler extends LogLevel to avoid autoloading issue when error is triggered on compile

* Revert "make ErrorHandler extends LogLevel to avoid autoloading issue when error is triggered on compile"

This reverts commit 8140f6026f59a2be9f80e562cf6ad6d441241593.

* call class_exists with force autoload set to true, to force the autoload of LogLevel on registration of the handlers
fabriceparallel 8 years ago
parent
commit
cc5f1eb34d
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/Monolog/ErrorHandler.php

+ 3 - 0
src/Monolog/ErrorHandler.php

@@ -58,6 +58,9 @@ class ErrorHandler
      */
     public static function register(LoggerInterface $logger, $errorLevelMap = array(), $exceptionLevel = null, $fatalLevel = null)
     {
+        //Forces the autoloader to run for LogLevel. Fixes an autoload issue at compile-time on PHP5.3. See https://github.com/Seldaek/monolog/pull/929
+        class_exists('\\Psr\\Log\\LogLevel', true);
+
         $handler = new static($logger);
         if ($errorLevelMap !== false) {
             $handler->registerErrorHandler($errorLevelMap);