I think we should consider moving the responsibility for global $user out of session.inc entirely. This is related to #335411: Switch to Symfony2-based session handling.
So in this case session.inc would just try to find a valid session based on the cookie.
Then user_boot() and user_exit() would figure out from the session if the user is authenticated or anonymous or not. We could probably move the uid to a value in the session data rather than a database column as well.
There's existing discussion about refactoring our session handling in general at #335411: Switch to Symfony2-based session handling but this feels like a smaller patch that could simplify that process a lot.
Comments
Comment #1
sdboyer commentedI agree. Detangling
global $userfrom the session lets us handle these problems in isolation, which does make things cleaner.Seems like this patch might be a good place to introduce the user wrapper to replace the global. That idea was in some of the original patches from #335411: Switch to Symfony2-based session handling, and is a mighty nice addition, especially for testing.
Comment #2
Anonymous (not verified) commentedyep, big me too on getting $user outta there.
Comment #3
sunThis issue almost sounds like a duplicate of #1549526: Change global $user into $session
Comment #4
znerol commented