1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-02-24 06:52:34 +01:00

Enforce the handler is callable before calling it

This commit is contained in:
Jordi Boggiano 2012-11-04 17:37:56 +01:00
parent 49143f3d11
commit 30b48f1231

View File

@ -79,10 +79,13 @@ class FingersCrossedHandler extends AbstractHandler
$this->buffering = false;
}
if (!$this->handler instanceof HandlerInterface) {
if (!is_callable($this->handler)) {
throw new \RuntimeException("The given handler (".json_encode($this->handler).") is not a callable nor a Monolog\Handler\HandlerInterface object");
}
$this->handler = call_user_func($this->handler, $record, $this);
}
if (!$this->handler instanceof HandlerInterface) {
throw new \RuntimeException("The factory callback should return a HandlerInterface");
if (!$this->handler instanceof HandlerInterface) {
throw new \RuntimeException("The factory callable should return a HandlerInterface");
}
}
$this->handler->handleBatch($this->buffer);
$this->buffer = array();