Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[TwigBundle] Deprecating "false" in favor of "kernel.debug" as default value of "strict_variable"#25780
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
curry684 commentedJan 13, 2018
👍 Status: reviewed |
nicolas-grekas commentedJan 16, 2018
BC break? Should be in a recipe instead? |
nicolas-grekas commentedJan 16, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
OH, it's already in a recipe, and the doc was accurate when starting with the standard edition, isn't it? |
curry684 commentedJan 16, 2018
Standard Edition has always explicitly defined it, see 2.7 @https://github.com/symfony/symfony-standard/blob/2.7/app/config/config.yml#L36. So given that all "supported" standard editions and the Flex recipe default it correctly we're only "BC breaking" people that explicitly removed it to fall back to a value that was documented to be identical to the default. Even if somebody actually did that (why?!?) they were expecting it to do this as documented ( Imho that's a very hard case to call a "BC break". |
yceruto commentedJan 16, 2018
Agree with@curry684, this BC break is very weird, however we can do something to solve it, right? |
nicolas-grekas commentedJan 17, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Yes we can: we just need to deprecate not setting the option. |
4bdf431 to85b6115Compare| ->booleanNode('strict_variables')->end() | ||
| ->booleanNode('strict_variables') | ||
| ->defaultValue(function () { | ||
| @trigger_error('No setting "strict_variables" to false is deprecated as of 4.1, it will be the value of the "kernel.debug" parameter by default in 5.0.',E_USER_DEPRECATED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@nicolas-grekas done, but I'm not completely sure if the numbers are correct:4.1 ...5.0 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Btw, is it the right way to do it? How can I avoid the deprecation notices in tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
You would need to configure a value explicitly instead of relying on the default value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks@xabbuh, I've made the changes, but in some places it seems out of place, so we need to remember remove it relying on the default value again in 5.0. The question is: how to remember that? i.e. what is the common practice in this case? adding a direct comment to the code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
in the past, we often added inline comments like "to be removed when ..." (at least, I used this phrase a lot to search for code that could be removed when we started the development on 4.0)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Inline comments added, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
We are now usingis deprecated as of Symfony 4.1
34b158c to9cd4637Compareyceruto commentedJan 24, 2018
Well, first step completed! Status: Needs Review |
5509b63 to1141a8aCompareyceruto commentedJan 25, 2018
Modified deprecation message. Status: Needs Review |
| ->booleanNode('strict_variables')->end() | ||
| ->booleanNode('strict_variables') | ||
| ->defaultValue(function () { | ||
| @trigger_error('Setting by default the "strict_variables" option to "false" under "twig" configuration is deprecated as of Symfony 4.1, it will be by default the value of the "kernel.debug" parameter in 5.0.',E_USER_DEPRECATED); |
nicolas-grekasFeb 4, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
What about:
Relying on the default value ("false") of the "twig.strict_variables" configuration option is deprecated since Symfony 4.1. You should use "%kernel.debug%" explicitly instead, which will be the new default in 5.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Agree with nicolas
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Much better, done, thanks!
1141a8a to4f74801Compare| 'namespaced_path3' =>'namespace3', | ||
| ), | ||
| 'paths' =>array( | ||
| 'namespaced_path3' =>'namespace3', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
The indentation of this line needs to be fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Fixed, thanks.
4f74801 to19f30e2Comparexabbuh commentedFeb 5, 2018
@yceruto Can you please also update the |
4dd428e to9572ebdCompare65db960 to922878eCompareyceruto commentedFeb 5, 2018
Should be ready now. |
fabpot commentedFeb 6, 2018
Thank you@yceruto. |
…ebug" as default value of "strict_variable" (yceruto)This PR was merged into the 4.1-dev branch.Discussion----------[TwigBundle] Deprecating "false" in favor of "kernel.debug" as default value of "strict_variable"| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | no| BC breaks? | no| Deprecations? | yes| Tests pass? | yes| Fixed tickets | -| License | MIT| Doc PR | ->http://symfony.com/doc/current/reference/configuration/twig.html#strict-variables>**strict_variables**> **type**: boolean **default**: `'%kernel.debug%'`Nope, really it's `false` by default:https://github.com/symfony/symfony/blob/1df45e43563a37633b50d4a36478090361a0b9de/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php#L130Fixing it insymfony/symfony-docs#9050, but yes `'%kernel.debug%'` is a better default value, the [TwigBundle recipe](https://github.com/symfony/recipes/blob/bf2148f9f1fe5af7e19c3145b6f7246c6cabb3a5/symfony/twig-bundle/3.3/config/packages/twig.yaml#L4:) affirms that:```yamltwig: # ... strict_variables: '%kernel.debug%'```So yeah, it definitely looks like it should be the default value, wdyt?Commits-------922878e Deprecating "false" as default value of "strict_variable" under Twig configuration
…trict_variables option (yceruto)This PR was merged into the 5.0-dev branch.Discussion----------[TwigBundle] Remove default value deprecation for twig.strict_variables option| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | -| License | MIT| Doc PR | -See previous PR in 4.1symfony/symfony#25780Commits-------83207370cb Remove default value deprecation for twig.strict_variables
…trict_variables option (yceruto)This PR was merged into the 5.0-dev branch.Discussion----------[TwigBundle] Remove default value deprecation for twig.strict_variables option| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | -| License | MIT| Doc PR | -See previous PR in 4.1#25780Commits-------8320737 Remove default value deprecation for twig.strict_variables
Uh oh!
There was an error while loading.Please reload this page.
Nope, really it's
falseby default:symfony/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php
Line 130 in1df45e4
Fixing it insymfony/symfony-docs#9050, but yes
'%kernel.debug%'is a better default value, theTwigBundle recipe affirms that:So yeah, it definitely looks like it should be the default value, wdyt?