Why is Yii::app()->user null even though other parts of the system still think the user is logged in?
I'm using the standard Yii authentication system with a CUserIdentity
class. I log in and tell it to remember the user for several days by setting the duration parameter of Yii::app()->user->login
.
I will use the开发者_开发技巧 site for awhile, and then come back maybe a day later (perhaps when the session would time out if there was no duration set?) and whenever I try to access the Yii::app()->user
object, it returns null and causes an internal server error.
Any ideas on what could be causing this? I would think that it would at least redirect to the login page if the user was actually logged out.
I dont know the issue with your code but just of reference,
The Yii::app()->user is not null even if user has not logged in. By default it is an object of CWebUser, if not changed in config file.
If a user is not logged in Yii::app()->user->isGuest is set to true.
精彩评论