-
-
Notifications
You must be signed in to change notification settings - Fork 615
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
Fatal error Cannot declare trait ForwardCompatAuthenticatorTrait #996
Comments
This seems related to preloading. I started getting this recently after some upgrades, and I disabled preloading temporarily until I figured out what's going on. The issue seems to happen with preload activated and Symfony 6+. On Symfony 5.4, all good. |
I start a new projet and i still got the error. this is my security.yaml : api/config/packages/security.yamlsecurity:
i can login and got the token but i can't access any route like /api/user_acocunts when i try to access to the route i gote Fatal error: Cannot declare trait Lexik\Bundle\JWTAuthenticationBundle\Security\Authenticator\ForwardCompatAuthenticatorTrait, because the name is already in use in /srv/api/vendor/lexik/jwt-authentication-bundle/Security/Authenticator/ForwardCompatAuthenticatorTrait.php(13) : eval()'d code on line 10 I think i follow the documentation but at this point know I am lost. |
Have you figure out what's wrong with the error? |
Same for me using LexikJWTAuthenticationBundle in combination with preloading |
I got the same error with:
|
Thank you, https://symfony.com/blog/new-in-symfony-5-1-configurable-php-preloading might help here. If one of you could try and confirm that would be great, or even submit a PR if possible :) Otherwise I'll have a look asap. |
In my case this error occoured only in Docker, not if using symfony serve. HTH |
Same issue here. also only with the prealoading |
Same issue with:
|
Created a pull to drop symfony 5.3 (and by requiring symfony 5.4, drop php 7.1) Symfony 5.3 is EOL anyways. Symfony 4.4 will be in the coming quarter. So i dont see any reason to hold support for those versions. PHP 7.1 is also EOL. same for any 7.x version. but i dont wanna go that far. Main reason. the execption comes with the eval() function, which is created in commit 82a0e67 but as php self says it not a very safe function. and given if we drop support on symfony <5.3 we dont need it any more. Please consider merging this in a |
If anyone alse has the RefreshTokenBundle: See: |
looks fixed for me, with both branches. if somebody wants to test it with me? I tested on Symfony 6.1 and PHP 8.1 you can require my forks composer.json
|
Same problem when generating assets in prod environment only, On symfony 6.1 & PHP 8.1 using : The fix provided by @wouter-toppy works well ! |
Hello, |
No matter if we want to keep compatibility with Symfony 5.3 or not, this compatibility should be done in another way, I believe. From my POV, and looking from a birds-eye view, a better approach would be to have separate versions of package if there are compatibility issues with different versions of other packages (Symfony in this case). But if it is problematic to have separate versions of the whole package, particular this compatibility may be extracted to separate versions. What I mean that this exact trait (ForwardCompapAuthenticatorTrait) can be extracted to a separate package (like, |
…lavrom) This PR was squashed before being merged into the 2.x branch. Discussion ---------- Fix ForwardCompatAuthenticatorTrait with OPCache preload Hi there, Since the `eval()` in the `ForwardCompatAuthenticatorTrait` is creating problems when OPCache preload is enabled, here is a quick fix to avoid eval()'ing multiple times. (Issue ref : #996) P.S. : First time making a PR, feel free to tell me if I did something wrong Commits ------- 325534b Fix ForwardCompatAuthenticatorTrait with OPCache preload
I got and error after install JWT package
Fatal error: Cannot declare trait Lexik\Bundle\JWTAuthenticationBundle\Security\Authenticator\ForwardCompatAuthenticatorTrait, because the name is already in use in /srv/api/vendor/lexik/jwt-authentication-bundle/Security/Authenticator/ForwardCompatAuthenticatorTrait.php(13) : eval()'d code on line 10
Is some one can't help me I can't found any clue why i gote this error
i try with php 8.0.2 and php 8.1 symfony 6.0 and both does work
The text was updated successfully, but these errors were encountered: