setState raises fatal error (file rights?)

Hi,

This code:




  public function actionSome() {

    Yii::app()->user->setState('thing','value');



Generates the error:

"Fatal error: Exception thrown without a stack frame in Unknown on line 0"

at one site, but not on another. I think the problem is in some file-rights, I just can’t figure out where…

Thanks.

Do you use a custom/extended session class?

Yes:




<?php

class CDbHttpSessionE extends CDbHttpSession {

	

	public function writeSession($id,$data) {

		$session = Session::model()->findByPk($id);

		if ($session === null) {

			$session = new Session();

			$session->id = $id;

		}

		$session->data = $data;

		$session->lastActivity = time();

		$session->userId = Yii::app()->user->id;

		$session->expire = time() + $this->getTimeout();

		$session->save();

		

		return true;

	}

	

}



But it’s used at both sites.

I don’t remember the exact case, but I think this error happend to me when I tried to access the session (readSession()) within a custom writeSession(). Means Yii::app()->user->id will internally call readSession() of course.

To debug further, can you try removing the access to the user component? Like:




// $session->userId = Yii::app()->user->id;


or


$session->userId = 123;