Skip to content

Commit

Permalink
Improve performance of is defined in non strict mode
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Jul 2, 2011
1 parent 661e9c7 commit e4b8371
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/Twig/Node/Expression/GetAttr.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ public function compile(Twig_Compiler $compiler)
{ {
$compiler->raw('$this->getAttribute('); $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( $compiler->subcompile(new Twig_Node_Expression_Filter(
$this->getNode('node'), $this->getNode('node'),
new Twig_Node_Expression_Constant('default', $this->getLine()), new Twig_Node_Expression_Constant('default', $this->getLine()),
Expand Down

0 comments on commit e4b8371

Please sign in to comment.