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

Undefined constant shown #990

Open
victormacko opened this issue Sep 27, 2022 · 3 comments
Open

Undefined constant shown #990

victormacko opened this issue Sep 27, 2022 · 3 comments
Labels

Comments

@victormacko
Copy link

victormacko commented Sep 27, 2022

It looks like the error reported in #983 is still happening - using PHP 8.1;

Uncaught PHP Exception Error: "Undefined constant "App\Entity\Member\AUTH_TYPE_ANY"" at /tmp/cache/prod/doctrine/orm/Proxies/__CG__AppEntityMemberMember.php line 1309

Exception: Error

  • Undefined constant "App\Entity\Member\AUTH_TYPE_ANY"

Stacktrace;

/tmp/cache/prod/doctrine/orm/Proxies/__CG__AppEntityMemberMember.php:1309
/var/task/src/Entity/Member/Member.php:2864
/tmp/cache/prod/doctrine/orm/Proxies/__CG__AppEntityMemberMember.php:1809
/var/task/src/Entity/Member/Member.php:2835
/tmp/cache/prod/doctrine/orm/Proxies/__CG__AppEntityMemberMember.php:1798
/var/task/src/Service/Event/MyService.php:272

Code;
This is referring to this method signature;

public function isMemberAuthorised(
string $section,
int $level_required,
$type = AUTH_TYPE_ANY,
$group = AUTH_GROUP_ANY
): bool {
...
}

Let me know if you need any more info - happy to help where I can.

@malarzm
Copy link
Member

malarzm commented Sep 28, 2022

@victormacko yesterday I've noticed that if you prefix global const with \ the generator will work good enough. I'll be looking into fixing this, but in the meantime could you please test #989? It'll solve your issue as long as consts have scalar values behind them.

@malarzm malarzm added the Bug label Sep 28, 2022
@malarzm malarzm added this to the 3.4.2 milestone Sep 28, 2022
@victormacko
Copy link
Author

The only way i've been able to reproduce this so far is occasionally in prod -- prefer not to be testing code in prod like that, and due to it's occasional nature, it's hard to reproduce in staging.
Is there any way to have it fixed without the '' prefixing the constants? ... there'd be no-way of knowing if things are breaking until it's all too late otherwise!

Thanks in advance for your help - it's super appreciated.

@malarzm malarzm modified the milestones: 3.4.2, 3.4.3 Sep 28, 2022
@nicolas-grekas
Copy link
Member

nicolas-grekas commented Sep 28, 2022

Also handled in https://github.com/symfony/symfony/blob/6.2/src/Symfony/Component/VarExporter/ProxyHelper.php#L318 for inspiration.

@malarzm malarzm modified the milestones: 3.4.3, 3.4.4 Oct 9, 2022
@derrabus derrabus removed this from the 3.4.4 milestone Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants