mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-14 11:27:00 +00:00
removed code that supports obsolete versions of PHP
This commit is contained in:
@@ -1293,13 +1293,10 @@ class Twig_Environment
|
||||
}
|
||||
|
||||
$tmpFile = tempnam($dir, basename($file));
|
||||
if (false !== @file_put_contents($tmpFile, $content)) {
|
||||
// rename does not work on Win32 before 5.2.6
|
||||
if (@rename($tmpFile, $file) || (@copy($tmpFile, $file) && unlink($tmpFile))) {
|
||||
@chmod($file, 0666 & ~umask());
|
||||
if ((false !== @file_put_contents($tmpFile, $content)) && @rename($tmpFile, $file)) {
|
||||
@chmod($file, 0666 & ~umask());
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
throw new RuntimeException(sprintf('Failed to write cache file "%s".', $file));
|
||||
|
||||
@@ -39,8 +39,7 @@ class Twig_Node_For extends Twig_Node
|
||||
{
|
||||
$compiler
|
||||
->addDebugInfo($this)
|
||||
// the (array) cast bypasses a PHP 5.2.6 bug
|
||||
->write("\$context['_parent'] = (array) \$context;\n")
|
||||
->write("\$context['_parent'] = \$context;\n")
|
||||
->write("\$context['_seq'] = twig_ensure_traversable(")
|
||||
->subcompile($this->getNode('seq'))
|
||||
->raw(");\n")
|
||||
|
||||
@@ -51,7 +51,7 @@ class Twig_Tests_Node_ForTest extends Twig_Test_NodeTestCase
|
||||
|
||||
$tests[] = array($node, <<<EOF
|
||||
// line 1
|
||||
\$context['_parent'] = (array) \$context;
|
||||
\$context['_parent'] = \$context;
|
||||
\$context['_seq'] = twig_ensure_traversable({$this->getVariableGetter('items')});
|
||||
foreach (\$context['_seq'] as \$context["key"] => \$context["item"]) {
|
||||
echo {$this->getVariableGetter('foo')};
|
||||
@@ -73,7 +73,7 @@ EOF
|
||||
|
||||
$tests[] = array($node, <<<EOF
|
||||
// line 1
|
||||
\$context['_parent'] = (array) \$context;
|
||||
\$context['_parent'] = \$context;
|
||||
\$context['_seq'] = twig_ensure_traversable({$this->getVariableGetter('values')});
|
||||
\$context['loop'] = array(
|
||||
'parent' => \$context['_parent'],
|
||||
@@ -116,7 +116,7 @@ EOF
|
||||
|
||||
$tests[] = array($node, <<<EOF
|
||||
// line 1
|
||||
\$context['_parent'] = (array) \$context;
|
||||
\$context['_parent'] = \$context;
|
||||
\$context['_seq'] = twig_ensure_traversable({$this->getVariableGetter('values')});
|
||||
\$context['loop'] = array(
|
||||
'parent' => \$context['_parent'],
|
||||
@@ -149,7 +149,7 @@ EOF
|
||||
|
||||
$tests[] = array($node, <<<EOF
|
||||
// line 1
|
||||
\$context['_parent'] = (array) \$context;
|
||||
\$context['_parent'] = \$context;
|
||||
\$context['_seq'] = twig_ensure_traversable({$this->getVariableGetter('values')});
|
||||
\$context['_iterated'] = false;
|
||||
\$context['loop'] = array(
|
||||
|
||||
Reference in New Issue
Block a user