- Issue created by @raphaelbertrand
- Merge request !8546Issue #3457168: Since twig/twig 3.9: error with "twig_escape_filter" function usage → (Open) created by Unnamed author
- Status changed to Needs review
7 days ago 4:12am 26 June 2024 - Status changed to Needs work
6 days ago 1:59pm 26 June 2024 - 🇫🇷France raphaelbertrand Lauris
I tried locally by replacing line 464 with :
return (string) $env->getRuntime(EscaperRuntime::class)->escape($arg, $strategy, $charset, $autoescape);
instead of return $env->getRuntime(EscaperRuntime::class)->escape($env, $return, $strategy, $charset, $autoescape);
and insert use Twig\Runtime\EscaperRuntime; at the begining of file - 🇫🇷France raphaelbertrand Lauris
raphaelbertrand → changed the visibility of the branch 3457168-since-twigtwig-3.9 to hidden.
- 🇫🇷France raphaelbertrand Lauris
mistake, as the return type is string|null:
i propose this correction :
return $env->getRuntime(EscaperRuntime::class)->escape($arg, $strategy, $charset, $autoescape);
instead of return $env->getRuntime(EscaperRuntime::class)->escape($env, $return, $strategy, $charset, $autoescape);
and insert use Twig\Runtime\EscaperRuntime; at the begining of filefor future, i think that as escape filter is overriden only for html strategy, it will be better to use setEscaper() method instead of overriding filter, but it need to use twig 3.10 minimum and it need more changes than this quick patch
- 🇫🇷France raphaelbertrand Lauris
@cilefen the change that broke this is internal at twig as the twig_escape_filter() is now declared as internal in twig, deprecated, and no more usable directly. As 10.3 use twig 3.9 or 3.10, it bring these changes into drupal.
- 🇫🇷France raphaelbertrand Lauris
raphaelbertrand → changed the visibility of the branch 3457168-since-twigtwig-3.9 to active.