Greetings,
I’m not quite sure if this is a bug in Yii, or a problem with Firefox 3.6/4 or IE 7/8/9.
I have a model which connects to an external API for a Shift Management company. As part of my authentication process, I authenticate against their servers and store the authentication response inside of Yii’s session (the API does this all automatically).
After successfully authenticating against their servers I redirect the user to one of two pages, both which require the session data to bet set and saved.
My login controller looks like this.
public function actionLogin() {
$this->layout='//layouts/column1';
$model=new LoginForm;
// collect user input data
if(isset($_POST['LoginForm']))
{
$model->attributes=$_POST['LoginForm'];
// validate user input and redirect to the previous page if valid
if($model->validate() && $model->login()) {
if (Yii::app()->user->getState('firstLogin') == 1)
$this->redirect(array('/firsttime'));
$this->redirect(Yii::app()->user->returnUrl);
}
}
// display the login form
$this->render('login',array('model'=>$model));
}
In Chrome 10.0.648.151 and Safari 5, $this->redirect(); successfully passes the session data to the next page. However in Firefox 3.6/4 AND IE7/8/9 the redirect loses the session. I can see in the debug consoles for both Firefox and IE that the session has been created and a cookie has been stored but the data ends up getting lost on the redirect.
If I remove the redirect, and cause my login controller to render the page, and then manually go to the page it is suppose to go to then the session sticks and I can proceed with what I was doing.
From what I can tell, Yii is losing the session data on redirect in both of these browsers.
Is there a way that I forcefully pass the session data to the next page on the redirect? The PHP manual for header indicates that I can pass the session via SID constant, but thus far I have been unsuccessful in doing so, as Yii doesn’t seem to be using this SID constant.
I’ve tried disabling both caching systems I have in place and none of the other solutions I have tried have seemed to work. I’ve also been able to replicate this on an XP Box with IE7/8 & Firefox 3.6
Any advice on how to fix this in the meantime?
Client OS: Windows 7 x64
Server OS: Ubuntu 10.04 LTS, Standard LAMP Stack + Memcache & APC
Yii Version: 1.1.6