8000 Receiving `Attempted to call an undefined method named "getVarName"` when upgrading to the latest `7.2.*` version · Issue #58702 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Receiving Attempted to call an undefined method named "getVarName" when upgrading to the latest 7.2.* version #58702

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

Closed
pan93412 opened this issue Oct 29, 2024 · 0 comments · Fixed by #58703

Comments

@pan93412
Copy link
Contributor
pan93412 commented Oct 29, 2024

Symfony version(s) affected

7.2 (91588b3)

Description

getVarName only appears on 7.1, and replaced with constant in 7.2:

private function getVarName(): string
{
return sprintf('__internal_%s', hash('xxh128', uniqid(mt_rand(), true)));
}

The 7.2 TranslationDefaultDomainNodeVisitor references getVarName, which does not exist in version 7.2:

This issue appears to stem from a mistakenly ahead porting by @nicolas-grekas. I'm unsure if it is safe to reference INTERNAL_VAR_NAME in this context.

private const INTERNAL_VAR_NAME = '__internal_trans_default_domain';

How to reproduce

  1. Clone https://github.com/database-playground/app-sf/tree/def0e92908d3eaadf41802142742a4d8b5e3f2b0
  2. Run composer update
  3. It throws Attempted to call an undefined method named "getVarName" of class "Symfony\Bridge\Twig \NodeVisitor\TranslationDefaultDomainNodeVisitor".

Possible Solution

Change getVarName to INTERNAL_VAR_NAME.

Additional Context

No response

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

Successfully merging a pull request may close this issue.

2 participants
0