Update Twig to v2.15.4

This commit is contained in:
slawkens
2023-02-02 10:37:45 +01:00
parent e552bcfe82
commit 130f7ba405
309 changed files with 3802 additions and 4005 deletions

View File

@@ -13,7 +13,6 @@ namespace Twig\Node;
use Twig\Compiler;
use Twig\Node\Expression\ConstantExpression;
use Twig\Node\Expression\FilterExpression;
/**
* Adds a check for the __toString() method when the variable is an object and the sandbox is activated.
@@ -42,28 +41,14 @@ class SandboxedPrintNode extends PrintNode
;
} else {
$compiler
->write('$this->env->getExtension(\'\Twig\Extension\SandboxExtension\')->ensureToStringAllowed(')
->write('$this->extensions[SandboxExtension::class]->ensureToStringAllowed(')
->subcompile($expr)
->raw(");\n")
->raw(', ')
->repr($expr->getTemplateLine())
->raw(", \$this->source);\n")
;
}
}
/**
* Removes node filters.
*
* This is mostly needed when another visitor adds filters (like the escaper one).
*
* @return Node
*/
protected function removeNodeFilter(Node $node)
{
if ($node instanceof FilterExpression) {
return $this->removeNodeFilter($node->getNode('node'));
}
return $node;
}
}
class_alias('Twig\Node\SandboxedPrintNode', 'Twig_Node_SandboxedPrint');