ZF-12347: Zend_Json_Encoder doesn't support IteratorAggregate

Description

Zend_Json_Encoder only traverses over objects of type Iterator, but not of type IteratorAggregate

--- library/Zend/Json/Encoder.php (revision 25022) +++ library/Zend/Json/Encoder.php (working copy) @@ -138,7 +138,7 @@ if (method_exists($value, 'toJson')) { $props =',' . preg_replace("/^{(.*)}$/","\1",$value->toJson()); } else { - if ($value instanceof Iterator) { + if ($value instanceof Traversable) { $propCollection = $value; } else { $propCollection = get_object_vars($value);

Comments

Attached patch implementing handling of IteratorAggregate

Applied patch to trunk (25058) and release-1.12 (25059)