Skip to content
Browse files

Improve performance of is defined in non strict mode

  • Loading branch information...
1 parent 661e9c7 commit e4b8371ab412b63a7472c36aa74c840ad4f142bc @nikic nikic committed Jul 2, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/Twig/Node/Expression/GetAttr.php
View
4 lib/Twig/Node/Expression/GetAttr.php
@@ -20,7 +20,9 @@ public function compile(Twig_Compiler $compiler)
{
$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()),

0 comments on commit e4b8371

Please sign in to comment.
Something went wrong with that request. Please try again.