Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[TwigBridge]  Use constant var name to cachetrans_default_domain expression result#57609

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

Merged
fabpot merged 1 commit intosymfony:7.2fromGromNaN:twig-uniqid-trans
Jul 1, 2024

Conversation

GromNaN
Copy link
Member

@GromNaNGromNaN commentedJun 30, 2024
edited
Loading

QA
Branch?7.2
Bug fix?no
New feature?no
Deprecations?no
IssuesPart of#57588
LicenseMIT

Whentrans_default_domain is used with an expression, the result of the expression is cached into a variable and this variable is stored in theScope to be used for each following usage of the|trans filter.

This var name doesn't need to be random:

  • there is only 1 value in the scope, more than 1 variable at a time is never necessary.
  • iftrans_default_domain is called a second time, the same variable can be reassigned.

The only benefit of using a random var name would be to prevent usage in the template. The name__internal_trans_default_domain self-explains that it is not meant to be used.

@carsonbotcarsonbot changed the title[TwigBridge] Use constant var name to cachetrans_default_domain expression result[TwigBridge]  Use constant var name to cachetrans_default_domain expression resultJun 30, 2024
@carsonbotcarsonbot added this to the7.2 milestoneJun 30, 2024
@fabpot
Copy link
Member

Thank you@GromNaN.

@fabpotfabpot merged commit68a5704 intosymfony:7.2Jul 1, 2024
9 of 10 checks passed
@GromNaNGromNaN deleted the twig-uniqid-trans branchJuly 1, 2024 17:07
@stof
Copy link
Member

stof commentedOct 25, 2024
edited
Loading

Using a fixed variable name is actually broken. The Twig scope is shared with all the inheritance tree of templates, so wedo have multiple names per scope (as{% trans_default_domain %} is meant to apply only to the current template)

Kocal pushed a commit to Kocal/symfony that referenced this pull requestFeb 13, 2025
… default domain node visitor (xabbuh)This PR was merged into the 7.2 branch.Discussion----------[TwigBridge] use reproducible variable names in the default domain node visitor| Q             | A| ------------- | ---| Branch?       | 7.2| Bug fix?      | no| New feature?  | yes| Deprecations? | no| Issues        |Fixsymfony#57609 (comment)| License       | MITCommits-------500d72f use reproducible variable names in the default domain node visitor
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
7.2
Development

Successfully merging this pull request may close these issues.

5 participants
@GromNaN@fabpot@stof@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp