Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TwigBundle] Deprecate option "autoescape", use "autoescape_service[_method]" instead #46052

Merged
merged 1 commit into from
Apr 16, 2022

Conversation

nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Apr 15, 2022

Q A
Branch? 6.1
Bug fix? no
New feature? no
Deprecations? yes
Tickets -
License MIT
Doc PR -

This option is a foot-gun, even the tests are wrong since true doesn't mean anything for it.
Also because eg disabling auto-escaping breaks forms / emails, which expect an html escaping strategy.

I therefore propose to deprecate option autoescape and to keep autoescape_service + autoescape_service_method, which are more capable, and will require ppl to think twice before returning false.

For ppl that need a custom escaping strategy, you'll likely want to use/take inspiration from FileExtensionEscapingStrategy::guess() in your implementation.

@fabpot
Copy link
Member

fabpot commented Apr 16, 2022

Thank you @nicolas-grekas.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants