Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
This is happening on every page load:
public function setDefaultStrategy($defaultStrategy)
{
// for BC
if (true === $defaultStrategy) {
@trigger_error('Using "true" as the default strategy is deprecated. Use "html" instead.', E_USER_DEPRECATED);
Proposed resolution
Use 'html'
Remaining tasks
Review patch
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Beta evaluation
Major bug because we are going into the error handler for a deprecation notice on every request
Comment | File | Size | Author |
---|---|---|---|
#3 | interdiff.txt | 1008 bytes | star-szr |
#3 | twig_autoescape_default-2567139-3.patch | 1.56 KB | star-szr |
twig-autoescape-html.patch | 593 bytes | stefan.r | |
Comments
Comment #2
joelpittet+1 to this. Twig's default is this as well so makes sense to change this.
Can we ensure that
TwigExtension::escapeFilter()
's last parameter is also using this?and
TwigExtensionTest::testEscaping()
andTwigExtensionTest::testSafeStringEscaping()
Comment #3
star-szrThanks for this @stefan.r, I found this too as part of #2555243: Upgrade path / plan to Twig 2.x aka 2.0.
Here's the other ones @joelpittet mentioned. I think escapeFilter() is different isn't it? It's not $strategy, the docs say:
Which is the same as what the upstream docs say plus/minus some capitalization ;)
Leaving that one alone for now.
Comment #4
joelpittetYou're right @Cottser ignore ::escapeFilter(), the strategy is got elsewhere.
This is a nice fix to keep this in sync with upstream and prevent
setDefaultStrategy
from triggering the deprecation notice.Comment #5
xjmNice find. Committed and pushed to 8.0.x. Thanks!