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:
parent
49143f3d11
commit
30b48f1231
@ -79,10 +79,13 @@ class FingersCrossedHandler extends AbstractHandler
|
|||||||
$this->buffering = false;
|
$this->buffering = false;
|
||||||
}
|
}
|
||||||
if (!$this->handler instanceof HandlerInterface) {
|
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);
|
$this->handler = call_user_func($this->handler, $record, $this);
|
||||||
}
|
if (!$this->handler instanceof HandlerInterface) {
|
||||||
if (!$this->handler instanceof HandlerInterface) {
|
throw new \RuntimeException("The factory callable should return a HandlerInterface");
|
||||||
throw new \RuntimeException("The factory callback should return a HandlerInterface");
|
}
|
||||||
}
|
}
|
||||||
$this->handler->handleBatch($this->buffer);
|
$this->handler->handleBatch($this->buffer);
|
||||||
$this->buffer = array();
|
$this->buffer = array();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user