From f87df8a2fb6912e316f4bceadd15af8c5c06e0bb Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 11 Jun 2010 07:20:33 +0200 Subject: [PATCH] fixed escaping for filtered object attributes (closes #59) --- lib/Twig/NodeVisitor/Escaper.php | 2 +- test/fixtures/tags/autoescape/objects.test | 2 ++ 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/lib/Twig/NodeVisitor/Escaper.php b/lib/Twig/NodeVisitor/Escaper.php index 1ceb38b..269dc47 100644 --- a/lib/Twig/NodeVisitor/Escaper.php +++ b/lib/Twig/NodeVisitor/Escaper.php @@ -71,7 +71,7 @@ class Twig_NodeVisitor_Escaper implements Twig_NodeVisitorInterface if ($expression instanceof Twig_Node_Expression_Filter) { // don't escape if the primary node of the filter is not a variable - if (!$expression->node instanceof Twig_Node_Expression_Name) { + if (!$expression->node instanceof Twig_Node_Expression_GetAttr && !$expression->node instanceof Twig_Node_Expression_Name) { return $node; } diff --git a/test/fixtures/tags/autoescape/objects.test b/test/fixtures/tags/autoescape/objects.test index 533aa30..44f41e1 100644 --- a/test/fixtures/tags/autoescape/objects.test +++ b/test/fixtures/tags/autoescape/objects.test @@ -3,6 +3,7 @@ --TEMPLATE-- {% autoescape on %} {{ user.name }} +{{ user.name|lower }} {% endautoescape %} --DATA-- class UserForAutoEscapeTest @@ -15,3 +16,4 @@ class UserForAutoEscapeTest return array('user' => new UserForAutoEscapeTest()) --EXPECT-- Fabien<br /> +fabien<br /> -- 1.7.2.5