1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-05 20:57:36 +02:00

FilterHandler: fix handle empty batch of filtered records

This commit is contained in:
David Maicher
2019-11-15 13:05:36 +01:00
parent d5e2fb341c
commit 525d29847a
2 changed files with 9 additions and 1 deletions

View File

@@ -128,7 +128,7 @@ class FilterHandler extends AbstractHandler
}
}
$this->getHandler($filtered[count($filtered) - 1])->handleBatch($filtered);
$this->getHandler(count($filtered) > 0 ? $filtered[count($filtered) - 1] : null)->handleBatch($filtered);
}
/**

View File

@@ -167,4 +167,12 @@ class FilterHandlerTest extends TestCase
);
$handler->handle($this->getRecord(Logger::WARNING));
}
public function testHandleEmptyBatch()
{
$test = new TestHandler();
$handler = new FilterHandler($test);
$handler->handleBatch(array());
$this->assertSame(array(), $test->getRecords());
}
}