Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Error: Trying to get property of non-object

More
6 years 6 months ago #158314 by jeffj
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)
Code:
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
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 6 months ago #158323 by DenisChenu
Replied by DenisChenu on 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 , plugin development .
I don't answer to private message.
The topic has been locked.
More
6 years 6 months ago #158352 by jeffj
Thank you very much Denis, you've solved our problem.

Jeff J
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose