Fatal Error: Call To A Member Function Isattributerequired() On A Non-Object

Hello

When I open a page in opera , my Yii app works well without error but when I open this page in Internet Explorer

Fatal error: Call to a member function isAttributeRequired() on a non-object in D:\Program Files\EasyPHP-DevServer-13.1VC9\data\localweb\protected\framework\web\helpers\CHtml.php on line 1237

To find why this error occurred , in my View I use var_dump , in Opera var_dump print my data but in Internet Explorer var_dump print Null , why??? I cannot understand?

Here is parts of relative codes

Model – User.php




public function relations()

	{

		return array(

			//.....

			'userInfo' => array(self::HAS_ONE, 'UserInfo', 'user_id'),

			//.....

		);

	}



UserController.php




$user=User::model()->findByPk($userID);

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



View – register.php




<?php 

//var_dump($model->userInfo); //For Debuge , Print Null in InternetExplorer and Print my data in Opera

echo $this->renderPartial('_infofield', array('form'=>$form,'info'=>$model->userInfo)); 

?>



View – _infofield.php




<div class="row">

	<?php echo $form->labelEx($info,'firstname'); ?>

	<?php echo $form->textField($info,'firstname'); ?>

	<?php echo $form->error($info,'firstname'); ?>

</div>



Help me Please :unsure:

A HAS_ONE relation (‘userInfo’ in your case) can be null. You have to confirm that it is not null before you try to read it.

The difference between Opera and IE is the difference of the User, I guess. When you see the page with Opera you are logged in as a User with userInfo, but when you see the page with IE … probably a guest user without userInfo. :)

OH , Nice , Yes

Thanks softark :lol: