From e4b8371ab412b63a7472c36aa74c840ad4f142bc Mon Sep 17 00:00:00 2001 From: nikic Date: Sat, 2 Jul 2011 11:20:54 +0200 Subject: [PATCH] Improve performance of is defined in non strict mode --- lib/Twig/Node/Expression/GetAttr.php | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/lib/Twig/Node/Expression/GetAttr.php b/lib/Twig/Node/Expression/GetAttr.php index 2208c9e..fcf50f6 100644 --- a/lib/Twig/Node/Expression/GetAttr.php +++ b/lib/Twig/Node/Expression/GetAttr.php @@ -20,7 +20,9 @@ class Twig_Node_Expression_GetAttr extends Twig_Node_Expression { $compiler->raw('$this->getAttribute('); - if ($this->hasAttribute('is_defined_test')) { + if ($this->hasAttribute('is_defined_test') + && $compiler->getEnvironment()->isStrictVariables() + ) { $compiler->subcompile(new Twig_Node_Expression_Filter( $this->getNode('node'), new Twig_Node_Expression_Constant('default', $this->getLine()), -- 1.7.2.5