From 1c9566f00743a5a9bd993ffe99b21b61efbf0886 Mon Sep 17 00:00:00 2001 From: fabien Date: Sat, 7 Nov 2009 18:54:37 +0000 Subject: [PATCH] made a small optimization when iterating over an Iterator git-svn-id: http://svn.twig-project.org/trunk@115 93ef8e89-cb99-4229-a87c-7fa0fa45744b --- lib/Twig/runtime_for.php | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-) diff --git a/lib/Twig/runtime_for.php b/lib/Twig/runtime_for.php index f2e508a..5ab9475 100644 --- a/lib/Twig/runtime_for.php +++ b/lib/Twig/runtime_for.php @@ -64,11 +64,7 @@ function twig_iterate(&$context, $seq) } elseif (is_object($seq) && $seq instanceof Iterator) { - $array = array(); - foreach ($seq as $value) - { - $array[] = $value; - } + $array = iterator_to_array($seq, false); } else { -- 1.7.2.5