Problem/Motivation
#2567257: hook_tokens() $sanitize option incompatible with Html sanitisation requirements changes the return values of hook_tokens(). That issue was all about ensuring that by default we escape the values.
Some of those support actual HTML, like taxonomy description, so they have to return SafeStringInterface to opt out of that behaviour.
Proposed resolution
Look at all core tokens to ensure that they return what is needed.
Comments
Comment #10
darvanenThis looks to me like a duplicate of #2580723: Fix token system confusion, with new function Token::replacePlain().
As it has had no discussion since it was posted 7 years ago, I will close it as such. Please feel free to reopen if you disagree or have further information.
Comment #11
adamps commentedI support closing of this issue. I did a quick scan and I didn't see any obvious bugs. I believe the OP hadn't actually detected a bug, he was just worried there might be one. After 7 years, there is no evidence there is actually a bug - and probably such a bug would be fairly obvious.
Actually I'm not sure it's a duplicate, so I changed the status. I think this issue is imagining a scenario where
hook_tokens()returns a value containing markup yet doesn't implementMarkupInterface. This would be a bug leading to double-escaping, so the issue was saying we should check that there isn't such a bug. It could be caused by something likereturn $markup1 . $markup2;- the concatenation loses theMarkupInterface.