bug #4161 Fix raw filter compat (fabpot)

This PR was merged into the 3.x branch.

Discussion
----------

Fix raw filter compat

Commits
-------

a1789129 Fix raw filter compat
This commit is contained in:
Fabien Potencier
2024-07-28 10:57:43 +02:00
+7
View File
@@ -25,6 +25,13 @@ class FilterExpression extends CallExpression
public function compile(Compiler $compiler): void
{
$name = $this->getNode('filter')->getAttribute('value');
if ('raw' === $name) {
trigger_deprecation('twig/twig', '3.11', 'Creating the "raw" filter via "FilterExpression" is deprecated; use "RawFilter" instead.');
$compiler->subcompile($this->getNode('node'));
return;
}
$filter = $compiler->getEnvironment()->getFilter($name);
$this->setAttribute('name', $name);