Pass charset to escaper callback again#4088
Conversation
| $this->escapers[$strategy] = $callable; | ||
| $callable = function ($string, $charset) use ($callable) { | ||
| return $callable($this->environment, $string); | ||
| return $callable($this->environment, $string, $this->environment->getCharset()); |
There was a problem hiding this comment.
It was indeed a mistake. I don't think we should restore this odd behavior as the callables never got the charset before (so without changing the escapers, the charset is not useful). And as adding the charset does not make migrating easier, I don't think we should support it.
There was a problem hiding this comment.
as the callables never got the charset before
Not sure what you mean? The callables did get the charset before:
Twig/src/Extension/EscaperExtension.php
Line 408 in a842d75
That's the BC break.
There was a problem hiding this comment.
Sorry, I'm stupid sometimes. See #4091 for the fix. Here, we need the charset passed to the escape filter, not the default charset.
Fixes #4087
This restores the behaviour of
3.9.xwhere the$charsetwas passed to the escaper callback.