mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-05 12:47:39 +02:00
Add support for consumed generators in NormalizerFormatter, fixes #838
This commit is contained in:
@@ -74,6 +74,10 @@ class NormalizerFormatter implements FormatterInterface
|
||||
$normalized = array();
|
||||
|
||||
$count = 1;
|
||||
if ($data instanceof \Generator && !$data->valid()) {
|
||||
return array('...' => 'Generator is already consumed, aborting');
|
||||
}
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
if ($count++ >= 1000) {
|
||||
$normalized['...'] = 'Over 1000 items, aborting normalization';
|
||||
|
Reference in New Issue
Block a user