Skip to content

Commit

Permalink
fixed escaping for filtered object attributes (closes twigphp#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Jun 11, 2010
1 parent 40b16ec commit f87df8a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Twig/NodeVisitor/Escaper.php
Expand Up @@ -71,7 +71,7 @@ protected function escapeNode(Twig_NodeInterface $node, Twig_Environment $env, $

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;
}

Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/tags/autoescape/objects.test
Expand Up @@ -3,6 +3,7 @@
--TEMPLATE--
{% autoescape on %}
{{ user.name }}
{{ user.name|lower }}
{% endautoescape %}
--DATA--
class UserForAutoEscapeTest
Expand All @@ -15,3 +16,4 @@ class UserForAutoEscapeTest
return array('user' => new UserForAutoEscapeTest())
--EXPECT--
Fabien<br />
fabien<br />

0 comments on commit f87df8a

Please sign in to comment.