From 115edf2a71560a95aff11ef428e05cb21a286345 Mon Sep 17 00:00:00 2001 From: Pierre Joye Date: Mon, 21 Nov 2011 14:02:02 +0100 Subject: [PATCH] - fix property access when the instance implements Iterator or similar cases, by using get_object_vars instead, thx Arnaud Leblanc for the hint. --- lib/Twig/Template.php | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Twig/Template.php b/lib/Twig/Template.php index f05c9b0..3207269 100644 --- a/lib/Twig/Template.php +++ b/lib/Twig/Template.php @@ -357,9 +357,11 @@ abstract class Twig_Template implements Twig_TemplateInterface // object property if (Twig_TemplateInterface::METHOD_CALL !== $type) { if (!isset(self::$cache[$class]['properties'])) { - foreach ($object as $k => $v) { - self::$cache[$class]['properties'][$k] = true; + $props = get_object_vars($object); + foreach ($props as &$v) { + $v = true; } + self::$cache[$class]['properties'] = $props; } if (isset(self::$cache[$class]['properties'][$item]) -- 1.7.2.5