Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Revert "merged branch m0ppers/master (PR twigphp#611)"
This reverts commit 5f4e6d7, reversing
changes made to a61d420.
  • Loading branch information
fabpot committed Feb 19, 2012
1 parent 5e11c67 commit 229239a
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions lib/Twig/Node/Expression/Name.php
Expand Up @@ -35,18 +35,29 @@ public function compile(Twig_Compiler $compiler)
} elseif ($this->isSpecial()) {
$compiler->raw($this->specialVars[$name]);
} else {
$compiler
->raw('$this->getContext($context, ')
->string($name)
;
if (version_compare(phpversion(), '5.4.0RC1', '>=') && ($this->getAttribute('ignore_strict_check') || !$compiler->getEnvironment()->isStrictVariables())) {
// PHP 5.4 ternary operator performance was optimized
$compiler
->raw('(isset($context[')
->string($name)
->raw(']) ? $context[')
->string($name)
->raw('] : null)')
;
} else {
$compiler
->raw('$this->getContext($context, ')
->string($name)
;

if ($this->getAttribute('ignore_strict_check')) {
$compiler->raw(', true');
}
if ($this->getAttribute('ignore_strict_check')) {
$compiler->raw(', true');
}

$compiler
->raw(')')
;
$compiler
->raw(')')
;
}
}
}

Expand Down

0 comments on commit 229239a

Please sign in to comment.