View Issue Details

This bug affects 1 person(s).
 14
IDProjectCategoryView StatusLast Update
13161Bug reportsSurvey takingpublic2018-01-24 15:50
Reportereheappey Assigned ToTonisOrmisson  
PrioritynormalSeveritypartial_block 
Status closedResolutionfixed 
Summary13161: Error page when submitting a form which has been saved for later and then resumed.
Description

When submitting a survey response which has been saved previously and then resumed we are getting the following error page appear:
"Internal Server Error
Call to a member function delete() on array"

When submitting a survey response which has not been saved and which has been completed in one session the response is submitted correctly.

TagsNo tags attached.
Attached Files
Bug heat14
Complete LimeSurvey version number (& build)Version 3.0.2+180110
I will donate to the project if issue is resolvedYes
Browser
Database type & versionMySQL 5.6.36
Server OS (if known)Windows 2012
Webserver software & version (if known)IIS
PHP Version7.0.27

Users monitoring this issue

eheappey

Activities

partofthething

partofthething

2018-01-16 19:06

reporter   ~45849

Confirmed. I have the same problem. Cannot submit completed survey due to this.

Version 3.0.1+171228
MySQL Ver 14.14 Distrib 5.7.20
PHP 7.0.22-0ubuntu0.16.04.1

pgs

pgs

2018-01-19 17:24

reporter   ~45924

Confirmed, same here.

pgs

pgs

2018-01-19 18:46

reporter   ~45927

Update: We also get the error that when submitting nothing submits, but last page is reloaded.

pgs

pgs

2018-01-20 12:25

reporter   ~45929

Hello,

this is the full debug output. I attached this output as a pdf also.

Error
Call to a member function delete() on array

/var/www/survey/application/helpers/expressions/em_manager_helper.php(5534)

5522 $cSave->set_answer_time();
5523 }
5524
5525 if ($finished) {
5526 // Delete the save control record if successfully finalize the submission
5527 $criteria = new CDbCriteria;
5528 $criteria->addCondition('srid=:srid');
5529 $criteria->addCondition('sid=:sid');
5530 $criteria->params = [':srid'=>$_SESSION[$this->sessid]['srid'],':sid'=>$this->sid];
5531 $savedControl = SavedControl::model()->findAll($criteria);
5532
5533 if($savedControl){
5534 $savedControl->delete();
5535 }
5536
5537 if (($this->debugLevel & LEM_DEBUG_VALIDATION_SUMMARY) == LEM_DEBUG_VALIDATION_SUMMARY) {
5538 $message .= ';<br />'.$query;
5539 }
5540
5541 }
5542 else if ($this->surveyOptions['allowsave'] && isset($_SESSION[$this->sessid]['scid']))
5543 {
5544 SavedControl::model()->updateByPk($_SESSION[$this->sessid]['scid'], array('saved_thisstep'=>$thisstep));
5545 }
5546 // Check Quotas
Stack Trace
#0
– /var/www/survey/application/helpers/expressions/em_manager_helper.php(5287): LimeExpressionManager->_UpdateValuesInDatabase(true)
5282 while (true)
5283 {
5284 $LEM->currentQset = array(); // reset active list of questions
5285 if (++$LEM->currentQuestionSeq >= $LEM->numQuestions) // Move next with finished, but without submit.
5286 {
5287 $message .= $LEM->_UpdateValuesInDatabase(true);
5288 $LEM->runtimeTimings[] = array(METHOD,(microtime(true) - $now));
5289 $LEM->lastMoveResult = array(
5290 'finished'=>true,
5291 'message'=>$message,
5292 'qseq'=>$LEM->currentQuestionSeq,
#1
– /var/www/survey/application/helpers/SurveyRuntimeHelper.php(843): LimeExpressionManager::NavigateForwards()
838 $this->aMoveResult = false; // so display welcome page again
839 }
840 }
841
842 if ($this->sMove == "movenext") {
843 $this->aMoveResult = LimeExpressionManager::NavigateForwards();
844 }
845
846 if (($this->sMove == 'movesubmit')) {
847 if ($this->sSurveyMode == 'survey') {
848 $this->aMoveResult = LimeExpressionManager::NavigateForwards();
#2
– /var/www/survey/application/helpers/SurveyRuntimeHelper.php(540): SurveyRuntimeHelper->setMoveResult()
535 $this->initTotalAndMaxSteps();
536 $this->checkIfUseBrowserNav(); // Check if user used browser navigation, or relaoded page
537
538 if ($this->sMove != 'clearcancel' && $this->sMove != 'confirmquota') {
539 $this->checkPrevStep(); // Check if prev step is set, else set it
540 $this->setMoveResult();
541 $this->checkClearCancel();
542 $this->setPrevStep();
543 $this->checkIfFinished();
544 $this->setStep();
545
#3
– /var/www/survey/application/helpers/SurveyRuntimeHelper.php(106): SurveyRuntimeHelper->initMove()
101 if (!isset($_SESSION[$this->LEMsessid]['step'])) {
102 $this->showTokenOrCaptchaFormsIfNeeded();
103 }
104
105 if (!$this->previewgrp && !$this->previewquestion) {
106 $this->initMove(); // main methods to init session, LEM, moves, errors, etc
107 $this->checkQuotas(); // check quotas (then the process will stop here)
108 $this->displayFirstPageIfNeeded();
109 $this->saveAllIfNeeded();
110 $this->saveSubmitIfNeeded();
111
#4
– /var/www/survey/application/controllers/survey/index.php(598): SurveyRuntimeHelper->run("516657", array("surveyid" => "516657", "thissurvey" => array("htmlemail" => "Y", "format" => "S", "template" => "fruity", "language" => "de", ...), "thisstep" => "64", "clienttoken" => "yP3azMcPHCXG2Io", ...))
593 unset($redata);
594 $redata = compact(array_keys(get_defined_vars()));
595 Yii::import('application.helpers.SurveyRuntimeHelper');
596 $tmp = new SurveyRuntimeHelper();
597 try {
598 $tmp->run($surveyid, $redata);
599 } catch (WrongTemplateVersionException $ex) {
600 echo $ex->getMessage();
601 }
602
603 if (App()->request->getPost('saveall')) {
#5
– /var/www/survey/application/controllers/survey/index.php(24): index->action()
19 public $oTemplate;
20
21 public function run()
22 {
23 useFirebug();
24 $this->action();
25 }
26
27 public function action()
28 {
29 global $surveyid;
#6
– /var/www/survey/framework/web/actions/CAction.php(76): index->run()
71 {
72 $method=new ReflectionMethod($this, 'run');
73 if($method->getNumberOfParameters()>0)
74 return $this->runWithParamsInternal($this, $method, $params);
75
76 $this->run();
77 return true;
78 }
79
80 /*
81
Executes a method of an object with the supplied named parameters.
#7
– /var/www/survey/framework/web/CController.php(308): CAction->runWithParams(array("sid" => "516657"))
303 {
304 $priorAction=$this->_action;
305 $this->_action=$action;
306 if($this->beforeAction($action))
307 {
308 if($action->runWithParams($this->getActionParams())===false)
309 $this->invalidActionParams($action);
310 else
311 $this->afterAction($action);
312 }
313 $this->_action=$priorAction;
#8
– /var/www/survey/framework/web/CController.php(286): CController->runAction(index)
281 @see runAction
282
/
283 public function runActionWithFilters($action,$filters)
284 {
285 if(empty($filters))
286 $this->runAction($action);
287 else
288 {
289 $priorAction=$this->_action;
290 $this->_action=$action;
291 CFilterChain::create($this,$action,$filters)->run();
#9
– /var/www/survey/framework/web/CController.php(265): CController->runActionWithFilters(index, array())
260 {
261 if(($parent=$this->getModule())===null)
262 $parent=Yii::app();
263 if($parent->beforeControllerAction($this,$action))
264 {
265 $this->runActionWithFilters($action,$this->filters());
266 $parent->afterControllerAction($this,$action);
267 }
268 }
269 else
270 $this->missingAction($actionID);
#10
– /var/www/survey/framework/web/CWebApplication.php(282): CController->run("index")
277 {
278 list($controller,$actionID)=$ca;
279 $oldController=$this->_controller;
280 $this->_controller=$controller;
281 $controller->init();
282 $controller->run($actionID);
283 $this->_controller=$oldController;
284 }
285 else
286 throw new CHttpException(404,Yii::t('yii','Unable to resolve the request "{route}".',
287 array('{route}'=>$route===''?$this->defaultController:$route)));
#11
– /var/www/survey/framework/web/CWebApplication.php(141): CWebApplication->runController("survey/index/sid/516657")
136 foreach(array_splice($this->catchAllRequest,1) as $name=>$value)
137 $_GET[$name]=$value;
138 }
139 else
140 $route=$this->getUrlManager()->parseUrl($this->getRequest());
141 $this->runController($route);
142 }
143
144 /
145 Registers the core application components.
146
This method overrides the parent implementation by registering additional core components.
#12
– /var/www/survey/framework/base/CApplication.php(185): CWebApplication->processRequest()
180 public function run()
181 {
182 if($this->hasEventHandler('onBeginRequest'))
183 $this->onBeginRequest(new CEvent($this));
184 register_shutdown_function(array($this,'end'),0,false);
185 $this->processRequest();
186 if($this->hasEventHandler('onEndRequest'))
187 $this->onEndRequest(new CEvent($this));
188 }
189
190 /

#13
– /var/www/survey/index.php(195): CApplication->run()
190 require_once APPPATH . 'core/LSYii_Application' . EXT;
191
192 $config = require_once(APPPATH . 'config/internal' . EXT);
193
194 Yii::$enableIncludePath = false;
195 Yii::createApplication('LSYii_Application', $config)->run();
196
197 / End of file index.php /
198 / Location: ./index.php /
2018-01-20 12:22:12 Apache Yii Framework/1.1.18

LSerror.pdf (178,407 bytes)
pgs

pgs

2018-01-20 12:30

reporter   ~45930

...and that's the apache2 error log entry:

Error::$statusCode in /var/www/survey/application/core/LSYii_Application.php on line 314, referer: https://survey.csi.uni-heidelberg.de/index.php/516657

eheappey

eheappey

2018-01-20 12:33

reporter   ~45931

Hi All,

I managed to get this working in the end by commenting out some of the code in one of the helpers. The side effect is that after submission someone will be able to go back in and amend their answer because it doesn't remove the saved answer however if they do this it overwrites the submission they originally made so for us it actually works better. Either way, the important thing for me is that it allows someone to submit a saved form.

The file i had to edit was em_manager_helper.php which is stored in the application\helpers\extension folder.

The lines i commented out were 5533 to 5535.

if($savedControl) {
$savedControl->delete();
}

We could still do with a proper fix but until then I hope this helps you all.

Ed

pgs

pgs

2018-01-20 12:36

reporter   ~45932

Thanks Ed, I will try this. One mistake in your post though: em_manager_helper.php is stored in the application\helpers\expression folder (not extension).

eheappey

eheappey

2018-01-20 12:51

reporter   ~45933

Ah yes sorry about that, it's been a long night...

pgs

pgs

2018-01-20 12:58

reporter   ~45934

Works like a charme, thanks again.

For us, the side effect is not really nice, indeed. But we think it's a negligible error.

kllam

kllam

2018-01-22 05:08

reporter   ~45935

Try to change the code like this, hope it's work

                    //$savedControl = SavedControl::model()->findAll($criteria);
                    //if($savedControl){
                    //    $savedControl->delete();
                    //}
                    $savedControls = SavedControl::model()->findAll($criteria);
                    foreach ($savedControls as $savedControl) {
                        $savedControl->delete();
                    }
c_schmitz

c_schmitz

2018-01-22 11:22

administrator   ~45946

Tonis, this was caused by you in 9897b1feb21985693b8478c9bc575a5d1ddb0513.
Please fix it - thank you!

TonisOrmisson

TonisOrmisson

2018-01-22 11:32

developer   ~45948

https://github.com/LimeSurvey/LimeSurvey/pull/948

TonisOrmisson

TonisOrmisson

2018-01-22 12:02

developer   ~45950

thanks guys

c_schmitz

c_schmitz

2018-01-24 15:50

administrator   ~46009

Version 3.1.0 released

Issue History

Date Modified Username Field Change
2018-01-11 10:00 eheappey New Issue
2018-01-11 10:02 eheappey Issue Monitored: eheappey
2018-01-16 19:06 partofthething Note Added: 45849
2018-01-19 17:24 pgs Note Added: 45924
2018-01-19 18:46 pgs Note Added: 45927
2018-01-20 12:25 pgs File Added: LSerror.pdf
2018-01-20 12:25 pgs Note Added: 45929
2018-01-20 12:30 pgs Note Added: 45930
2018-01-20 12:33 eheappey Note Added: 45931
2018-01-20 12:36 pgs Note Added: 45932
2018-01-20 12:51 eheappey Note Added: 45933
2018-01-20 12:58 pgs Note Added: 45934
2018-01-22 05:08 kllam Note Added: 45935
2018-01-22 10:48 LouisGac Assigned To => markusfluer
2018-01-22 10:48 LouisGac Status new => assigned
2018-01-22 11:21 c_schmitz Assigned To markusfluer => TonisOrmisson
2018-01-22 11:22 c_schmitz Note Added: 45946
2018-01-22 11:26 c_schmitz Priority none => normal
2018-01-22 11:32 TonisOrmisson Note Added: 45948
2018-01-22 12:02 TonisOrmisson Status assigned => resolved
2018-01-22 12:02 TonisOrmisson Resolution open => fixed
2018-01-22 12:02 TonisOrmisson Note Added: 45950
2018-01-24 15:50 c_schmitz Note Added: 46009
2018-01-24 15:50 c_schmitz Status resolved => closed
2021-08-03 02:19 guest Bug heat 12 => 14