Browse Source

Partially prevent circular references in the handler chain

Jordi Boggiano 15 years ago
parent
commit
1983270611
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/Monolog/Logger.php

+ 3 - 0
src/Monolog/Logger.php

@@ -72,6 +72,9 @@ class Logger
     public function pushHandler(HandlerInterface $handler)
     {
         if ($this->handler) {
+            if ($this->handler === $handler) {
+                throw new \UnexpectedValueException('Circular reference, do not add the same handler instance twice.');
+            }
             $handler->setParent($this->handler);
         }
         $this->handler = $handler;