Improve performance of is defined in non strict mode

This commit is contained in:
nikic
2011-07-02 11:20:54 +02:00
parent 661e9c7ad2
commit e4b8371ab4
+3 -1
View File
@@ -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()),