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.
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)…
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…
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.