1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-23 01:26:11 +02:00

Fix level map override when using setExceptionHandler, fixes #1005

This commit is contained in:
Jordi Boggiano
2017-06-19 03:08:32 +02:00
parent 443e4a94fc
commit 69b21064ca
2 changed files with 11 additions and 20 deletions

View File

@@ -77,7 +77,12 @@ class ErrorHandler
public function registerExceptionHandler($levelMap = [], $callPrevious = true): self
{
$prev = set_exception_handler([$this, 'handleException']);
$this->uncaughtExceptionLevelMap = array_replace($this->defaultExceptionLevelMap(), $levelMap);
$this->uncaughtExceptionLevelMap = $levelMap;
foreach ($this->defaultExceptionLevelMap() as $class => $level) {
if (!isset($this->uncaughtExceptionLevelMap[$class])) {
$this->uncaughtExceptionLevelMap[$class] = $level;
}
}
if ($callPrevious && $prev) {
$this->previousExceptionHandler = $prev;
}