Undefined property CWebApplication::$user

Hi,

one of my users on iOs Safari is getting error Undefined property CWebApplication::$user. So he can not log in or logout or do anything, cause every "Yii::app()->user" causes the above error. Any ideas?

Thanks!

Ask him to clean his/her cookies?

thx! I shall. So if it is cookies, how do I fix it?

No idea, I’ve never got this kind of error. Because you said it was specific to one user, my guess was a wrong persistent cookie which may have caused the user module to do not load properly. This is a possibility only if you use ‘autologin’ true in your config file.

I guess for fixing it you would have to be able to reproduce the error.

Jap, this is a strange one. Thanks anyway, I will post the solution if I ever find one :expressionless:

I’d rather suspect you have a typo somewhere. Check every code location mentioned in the callstack (it’s a bit hard to follow from the image you’ve posted).

The thing is it is working for other users and it is working for the same username when I am login in.

What happens in line 30 of components/Controller.php? The framework doesn’t use CWebApplication::$user anywhere - and you can’t inject this code from outside.

#30 if( Yii::app()->user->isGuest)

Am I using it wrong?

Did you configure a custom user component (a.k.a. a class that extends CWebUser)? Did you also thoroughly check AccountIdentity (and all the other locations mentioned in the call stack)?

Yes, I did configure a custom user component. I will check again, thanks!

I have checked. It is "Yii::app()->user". I do think it is a cookie thing, I am not sure yet how to test it

Have you test that user on a different browser? Is it working? could you check the security settings on that browser (the Safari that fails)? does it work on that browser (the Safari that fails) with different usernames?