Error: Trying to get property of non-object

More
1 month 2 weeks ago #158314 by jeffj
jeffj created the topic: Error: Trying to get property of non-object
We have two instances on Limesurvey running. Both are v2.06+ and have been running smoothly for years.

Now we are getting this error when people with admin access attempt to visit the admin page (.../index.php/admin/):

PHP notice

Trying to get property of non-object

.../application/helpers/common_helper.php(148)
136     if(is_null($cached)) {
137         $args = array('order'=>'surveyls_title');
138         if (!Permission::model()->hasGlobalPermission('superadmin','read'))
139         {
140             $surveyidresult = Survey::model()->permission(Yii::app()->user->getId())->with('defaultlanguage')->findAll($args);
141         } else {
142             $surveyidresult = Survey::model()->with('defaultlanguage')->findAll($args);
143         }
144 
145         $surveynames = array();
146         foreach ($surveyidresult as $result)
147         {
148             $surveynames[] = array_merge($result->attributes, $result->defaultlanguage->attributes);
149         }
150 
151         $cached = $surveynames;
152     } else {
153         $surveynames = $cached;
154     }
155     $surveyselecter = "";
156     if ($returnarray===true) return $surveynames;
157     $activesurveys='';
158     $inactivesurveys='';
159     $expiredsurveys='';
160     if ($surveynames)

The surveys themselves seem fine, just the admin page has the error. It is only happening with one of our instances, which seems very odd. They are both hosted on the same server (CentOS).
The only difference between them is one is secured and requires survey respondents to authenticate - this version works fine. The non-secured instance is the one returning the above error.

Thank you
Jeff J

Please Log in to join the conversation.

More
1 month 2 weeks ago #158323 by DenisChenu
DenisChenu replied the topic: Error: Trying to get property of non-object
One of your survey didn't have the language in the SurveyLanguage table (in DB).

1: disable Debug Mode (it's enable currently)
2: Use the "Check the database" button/menu (one menu at top to fix this kind of error).

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
1 month 2 weeks ago #158352 by jeffj
jeffj replied the topic: Error: Trying to get property of non-object
Thank you very much Denis, you've solved our problem.

Jeff J

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now