mirror of
https://github.com/Seldaek/monolog.git
synced 2025-07-31 18:30:15 +02:00
Partially prevent circular references in the handler chain
This commit is contained in:
@@ -72,6 +72,9 @@ class Logger
|
|||||||
public function pushHandler(HandlerInterface $handler)
|
public function pushHandler(HandlerInterface $handler)
|
||||||
{
|
{
|
||||||
if ($this->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);
|
$handler->setParent($this->handler);
|
||||||
}
|
}
|
||||||
$this->handler = $handler;
|
$this->handler = $handler;
|
||||||
|
Reference in New Issue
Block a user