Преглед на файлове

Don't even try to attempt normalizing iterators or generators in context

Iterators and Generators may not be rewindable, so foreach is not safe
to use on them.

Iterators and especially Generators may trigger irreversible actions on
calling next(), so iterating over all values can potentially cause harm,
e.g. imagine an iterator over a set of HTTP POST requests that are sent
when the next value is requested . The only sufficiently safe thing to
iterate and include here are primitive arrays.
Garrick Lam преди 6 години
родител
ревизия
b271cd4294
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  1. 1 1
      src/Monolog/Formatter/JsonFormatter.php

+ 1 - 1
src/Monolog/Formatter/JsonFormatter.php

@@ -145,7 +145,7 @@ class JsonFormatter extends NormalizerFormatter
             return 'Over 9 levels deep, aborting normalization';
             return 'Over 9 levels deep, aborting normalization';
         }
         }
 
 
-        if (is_array($data) || $data instanceof \Traversable) {
+        if (is_array($data)) {
             $normalized = array();
             $normalized = array();
 
 
             $count = 1;
             $count = 1;