tweaked sandbox generated code

This commit is contained in:
Fabien Potencier
2019-03-11 08:52:26 +01:00
parent 7ce5261621
commit cbb8f6edc1
5 changed files with 10 additions and 10 deletions
+3 -4
View File
@@ -29,16 +29,15 @@ class SandboxNode extends Node
{
$compiler
->addDebugInfo($this)
->write("\$sandbox = \$this->env->getExtension('\Twig\Extension\SandboxExtension');\n")
->write("if (!\$alreadySandboxed = \$sandbox->isSandboxed()) {\n")
->write("if (!\$alreadySandboxed = \$this->sandbox->isSandboxed()) {\n")
->indent()
->write("\$sandbox->enableSandbox();\n")
->write("\$this->sandbox->enableSandbox();\n")
->outdent()
->write("}\n")
->subcompile($this->getNode('body'))
->write("if (!\$alreadySandboxed) {\n")
->indent()
->write("\$sandbox->disableSandbox();\n")
->write("\$this->sandbox->disableSandbox();\n")
->outdent()
->write("}\n")
;