1
0
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:
Jordi Boggiano
2013-06-07 10:26:13 +02:00
parent a3864e0b9f
commit a43f926ffe

View File

@@ -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);
}