Session regenerateId()


since I’ve upgraded to 1.1.8, it is not possible to login anymore to my webapp. I enter the correct login/password, but user remains not logged in. After some investigation, I tried to comment out the call to Yii::app()->getSession()->regenerateID(); in CWebUser (line 680) … and then everything is back to normal.

On the site, some comments are related to a possible problem with session_regenerate_id() …

Has anyone experienced such problem ? any idea to fix it ?



When you try to regenerate the id?

yes … that is done internally by CWebUser since 1.1.8 on successful login.

Methode CWebUser->login() invokes CWebUser->changeIdentity() which calls Yii::app()->getSession()->regenerateID();


If we go to the source code, maybe afterLogin doing something? :rolleyes:


maybe there’s another cookie created for session?

I had a problem related to facebook php api, which was starting session on its own.

All I did was adding session component to be preloaded, just like log, and that resolved my session issues.

unfortunatly, preloading the session component doesn’t solve my problem … until I find a solution I had to go back to 1.1.7 :(

Maybe if you compare the changes, it will clear the source of the problem for you :unsure:

Well, the only change is Yii being updated to 1.1.8 … no other changes in my app.


After the upgrade, did you clean out assets and protected/runtime?

Maybe if you got rid of state.bin in protected/runtime?

It would be worth at try. ;)

Thanks for the suggestion Jacmoe … I tried that but unfortunatly with same result. Anyway, as I’m using CDbHttpSession so if I’m not mistaken, state.bin is not used.



I did try CDbHttpSession with the latest yii version (1.1.9_dev) and 1.1.8, both worked excellent with default (not set) connectionID (which is sqlite3) and my own connectionID (mysql). Maybe try usign default db (sqlite) and see if it still does not work?

Did you try clearing your browser’s cookies? Or maybe there are two cookies named PHPSESSID? Check that with Google Chrome or FF with WebDeveloper plugin or other…

Anyway, it looks like it has to be something related to your project/setup/config/database/browser ;)

Ok, thanks for your reply drylko, I’ll test all that …