-
-
Notifications
You must be signed in to change notification settings - Fork 415
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
Support class inheritance in UserProvider::supportsClass by default #532
Conversation
Check if given class name is inherited (i.e. Doctrine Proxies) from the User class like the default implementation does.
There is nothing directly wrong with doing So I'm leaning towards keeping the current |
And it's wrong if e.g. using an ORM to load the user or other cases where you can end up getting a proxy object (which seems to be the main issue lately). As for the strictness, that's indeed a valid point ... My alternate proposition was to add a note to the Custom User Provider documentation (and maybe add a link to that in the nextSteps message). How about that? |
Oh, I missed this. Then definitely 👍 (99.999% of the applications uses some sort of Doctrine library to save the user I think) |
I also suffered this problem. Every page load resulted in this error: @linaori kindly pointed me to this PR, so I applied the proposed fix and everything works now as it should. Please, consider merging this as soon as possible. Thanks! |
Same issue as @javiereguiluz mentioned, it was pointed to me by someone from support sf channel. It appeared with the new sf minor update -- tests started failing on my app. This fixed the issue, thanks. |
Thanks @MisatoTremor! Sorry for the delay - I don't know how I missed this PR! |
This PR was submitted for the master branch but it was merged into the 4.4 branch instead. Discussion ---------- minor [#14292] UserProvider::supportsClass symfony/maker-bundle#532 Commits ------- 2b02a0a minor [#14292] UserProvider::supportsClass
I propose to add the check if given class name is inherited from the User class (like the EntityUserProvider implementation does) to the UserProvider template.
Also I would follow up with a documentation PR reflecting that change in https://github.com/symfony/symfony-docs/blob/master/security/user_provider.rst
Or would it better to just add a info about this additional check to the documentation?