Having Problem With Yii Framework --- Help Me ... Its Urgent

I’m having problem with one of my project where I used yii framework.

A week ago it was OK. but from last 2 days I cant access in my web.

It’s showing error in every pages “Undefined index: id” or “Trying to get property of non-object” in /var/www/vhosts/******/httpdocs/yii_fw/framework/base/CComponent.php(606) : eval()'d code(1)

in some cases i resolved problem using isset in lots of $_GET[] but I don’t think a stable solution. Site was ok few days ago with all the content that I’ve now in it.

For extra information: I’ve transfered files from one server to another. and also when I saw it’s not working I upgraded my yii version to latest one.

I searched on the forum in some cases people talked about putting keyField in cArrayDataProvider. But I’m not using any cArrayDataProvider in my project. I used cActiveDataProvider and which is not accepting keyField parameter. I’ve also cSqlDataProvider but those pages which are using cSqlDataProvider is working fine without keyField.

Could anyone please help me to resolve this problem…

this is my first post here, so I don’t know if it’s the right place to post my problem.

Thanks

those are normally reported as PHP notices. if earlier everything worked and then stopped - maybe someone changed global error_reporting configuration for PHP (included E_NOTICE in reported errors). you could set error_reporting to E_ALL & ~E_NOTICE to stop those errors, however - you should write your apps better (for example instead of referencing $_GET you could use Yii::app()->request->getParam( ‘param’, ‘defaultValue’ ); which prevents such notices)…

Thanks RedGuy…

next time i’ll keep this referencing $_GET to Yii::app()->request->getParam suggetions in mind…

Now I’m going to try to change the configuration of PHP.

I guess that’s what is creating problems.

Thanks a lot… =)

Usually the best practise is really making sure that the variable isset.

Other ways usually are work-arounds (including turning off errors or changing the PHP behaviour when checking if variables exist).

You’re right Ivo.

I normally use isset but at the beginning of using Yii I saw that it works fine without isset thats why i did’nt show too much interest on isset. and also i didn’t check the php config and yii_fw folder. It was working perfectly on the previous server. But when I changed it to another it occurs this problems.

And i guess error reporting config is not same as the previous one.

Now I asked to the admin to change the config, let’s see if it resolves the problem. Otherwise I’ll have to look for thousands of gets and posts in my project to put isset with all of them… :unsure:

You probably don’t need the admin to do it, you could just use error_reporting() at the top of your application index.php file.

Yeeeee!!!!

It works… :)

Thanks redGuy, Ivo and Keith… for your comments and suggesions…

I put error_reporting(0); in index.php of the home page and it’s solves the problem :D

;D

You should really only consider that a temporary solution while you fix the problems that caused the errors. Turning off error reporting may mask important issues and make any coding errors difficult to debug.

Ya, I guess so.

Hiding errors never be a good solution.

I’ll keep this problem in my mind on future projects.

Thanks Keith.