Wierd Login/Debug Issue

Hi Guys,

Got a strange issue here, it’s probably something obvious but I can’t see it right now.

When debug is on my login action works 100%. (


defined('YII_DEBUG') or define('YII_DEBUG',true);

)

As soon as I turn debugging off the login page displays an error when the form is submitted, as follows:

CHttpException

Unable to resolve the request "site/error".

My login action is pretty standard:


	public function actionIndex()

	{

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

		{

			$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

				echo Yii::app()->user->returnUrl;

				if($model->validate() && $model->login()){

						$this->redirect(Yii::app()->user->returnUrl);

				}


			}

		

			// display the login form

			$this->render('index',array('model'=>$model));

		}else{

			// display already logged in notice

			$this->render('loggedin');

		}

	}

Has anyone seen anything like this before, any ideas?

Thanks for your time.

There is an error somewhere it might not be in your login, but the thing is yii is not correctly configured to display the errors, please check http://www.yiiframework.com/doc/guide/1.1/en/topics.error#displaying-errors

Hi,

Thanks for your time/reply.

I set-up the site/error action and view properly and the error was due to runtime/state.bin not being writeable.

I don;t know why this problem doesn’t appear when in debug mode but it seems ok now.

Thanks again.