Hey
I am implementing a user matching system, and if a user is matched they are logged out of their current account and logged in to a different one.
My sessions are CDbSessions and when the user is logged in to another account I get the following error:
CDbCommand failed to execute the SQL statement: SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value violates unique constraint "yiisessionlist_pkey". The SQL statement executed was: INSERT INTO "yiisessionlist" ("id", "expire", "data") VALUES (:id, :expire, :data)
You can reproduce this by doing the following in the beginRequest event:
Yii::app()->user->logout(true);
$identity=new UserIdentity("user", "pass");
if($identity->authenticate()){
Yii::app()->user->login($identity, 3600*24*7);
Yii::app()->user->cInit();
}
die();
If you view the page twice you get the mentioned error.
Is there any easy way to fix this? And is this expected behavior?
Thanks
crasx