mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-04 20:27:31 +02:00
Abort normalization of traversables after 1000 items have been discovered, fixes #201
This commit is contained in:
@@ -61,7 +61,12 @@ class NormalizerFormatter implements FormatterInterface
|
||||
if (is_array($data) || $data instanceof \Traversable) {
|
||||
$normalized = array();
|
||||
|
||||
$count = 1;
|
||||
foreach ($data as $key => $value) {
|
||||
if ($count++ >= 1000) {
|
||||
$normalized['...'] = 'Over 1000 items, aborting normalization';
|
||||
break;
|
||||
}
|
||||
$normalized[$key] = $this->normalize($value);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user