- fix property access when the instance implements Iterator or similar cases, by using get_object_vars instead, thx Arnaud Leblanc for the hint.

This commit is contained in:
Pierre Joye
2011-11-21 14:02:02 +01:00
parent 7bc07dc132
commit 115edf2a71
+4 -2
View File
@@ -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])