View Issue Details

This bug affects 1 person(s).
IDProjectCategoryView StatusLast Update
09772Bug reportsSurvey takingpublic2015-07-24 11:44
Reporterscottturnbull Assigned ToDenisChenu  
Status closedResolutionfixed 
Product Version2.05+ 
Fixed in Version2.06+ 
Summary09772: Using "Previous" Button to Navigate back to Welcome Screen before Exit Makes ReVisiting Fail

When running a survey that uses tokens allowing revisiting of the survey,
if the participant navigates down into the survey, then uses the "Previous" button to navigate back to the Welcome screen before closing the survey window,

this results in the saved "Last Page" for that token to be saved as -1, and the survey can no longer be visited for that token.

The result is a PHP error with "Undefined index: gid" message.

Steps To Reproduce

Create a survey with a welcome and one or two question groups.
Turn on use of the "Previous" button. (see attached .lss file for a sample)

Activate tokens for the survey, configure the token use allowing the survey to be revisited with a single token.

Create a token.

Activate the survey, so that data records are kept.

Using the Token Administration dialog, access the survey for the token.

Use Next button to move from welcome to first page of questions.
As a Control Case, close the survey now.
Use the Token Administration dialog to access the survey for the same token.
There should be no error, and the survey is re-accessed as expected.

Now use the Next button to move down into the survey.
Use the Previous button to move back up to the Welcome screen.
Exit the survey by closing the window while the welcome screen is displayed.

Use the Token Admin dialog to access the survey again for the same token.
At this point I receive a PHP error for "Undefined index: gid". Details below.

Doing an export of the saved response associated with the token shows that the "Last Page" field has a value of -1.

Additional Information

Trivial survey exhibiting the issue is attached as an .lss file.

PHP notice and stack trace that is generated by the error pasted below...

PHP notice

Undefined index: gid


755 else if ($surveyMode != 'survey')
756 {
757 if ($previewquestion) {
758 $_qid = sanitize_int($param['qid']);
759 LimeExpressionManager::StartSurvey($surveyid, 'question', $surveyOptions, false, $LEMdebugLevel);
760 $qSec = LimeExpressionManager::GetQuestionSeq($_qid);
761 $moveResult = LimeExpressionManager::JumpTo($qSec+1,true,false,true);
762 $stepInfo = LimeExpressionManager::GetStepIndexInfo($moveResult['seq']);
763 } else {
764 $stepInfo = LimeExpressionManager::GetStepIndexInfo($moveResult['seq']);
765 }
767 $gid = $stepInfo['gid'];
768 $groupname = $stepInfo['gname'];
769 $groupdescription = $stepInfo['gtext'];
770 }
771 }
772 if ($previewquestion)
773 {
774 $_SESSION[$LEMsessid]['step'] = 0; //maybe unset it after the question has been displayed?
775 }
777 if ($_SESSION[$LEMsessid]['step'] > $_SESSION[$LEMsessid]['maxstep'])
778 {
779 $_SESSION[$LEMsessid]['maxstep'] = $_SESSION[$LEMsessid]['step'];

TagsNo tags attached.
Attached Files
Bug heat22
Complete LimeSurvey version number (& build)unknown (user, not admin)
I will donate to the project if issue is resolvedNo
BrowserFirefox 39.0
Database type & versionMySQL Percona 5.5
Server OS (if known)Apache/2.2.15 (Red Hat) Yii Framework/1.1.15
Webserver software & version (if known)Apache/2.2.15 (Red Hat) Yii Framework/1.1.15
PHP Version5.3.29


has duplicate 09658 closedc_schmitz Responses cannot be saved 

Users monitoring this issue

There are no users monitoring this issue.




2015-07-11 11:09

developer   ~32669


Can you test with last 2.06 version ?
Undefined index: gid is due to debug=2, can you test if user can do the survey with debug=0



2015-07-11 18:36

developer   ~32670

2.06 : same bug :)



2015-07-11 18:56

developer   ~32671

Fix committed to master branch:



2015-07-11 19:06

developer   ~32672

Fix committed to develop branch:



2015-07-13 14:54

reporter   ~32675

Thanks for the prompt review and fix. I'll let the campus admin know that we're backlevel (2.05+) and that a fix is waiting in (2.06+). Can you tell me whether the fix tolerates the data records that previously prevented access to the survey, or whether the fix prevents the generation of the saved data that broke the survey access? The former would resurrect access for tokens that have bent data. The latter would make sure no bad data is generated going into the future.



2015-07-13 16:09

developer   ~32676


The fix can be easily apply to any 2.05, just after testing is $_SESSION[$LEMsessid]['step'] is set. then after the else:
$_SESSION[$LEMsessid]['step']=$_SESSION[$LEMsessid]['step']<0 ? 0 : $_SESSION[$LEMsessid]['step'];



2015-07-24 11:44

administrator   ~32777

Version 2.06 Build 150723 released

Related Changesets

LimeSurvey: master 63c722de

2015-07-11 16:55:48


Details Diff
Fixed issue 09772: Using "Previous" Button to Navigate back to Welcome Screen before Exit Makes ReVisiting Fail
Dev: debug 0 show and empty group with preview and next
Dev: globally force $_SESSION[$LEMsessid]['step'] to 0 or up
Affected Issues
mod - application/helpers/SurveyRuntimeHelper.php Diff File

LimeSurvey: develop 13f48a76

2015-07-11 17:05:45


Details Diff
Fixed issue 09772: Using "Previous" Button to Navigate back to Welcome Screen before Exit Makes ReVisiting Fail
Dev: force 0 or throw error ? Here force 0.
Affected Issues
mod - application/components/SurveySession.php Diff File

Issue History

Date Modified Username Field Change
2015-07-10 21:31 scottturnbull New Issue
2015-07-10 21:31 scottturnbull File Added: limesurvey_survey_635925.lss
2015-07-11 11:09 DenisChenu Note Added: 32669
2015-07-11 11:09 DenisChenu Assigned To => DenisChenu
2015-07-11 11:09 DenisChenu Status new => feedback
2015-07-11 18:36 DenisChenu Note Added: 32670
2015-07-11 18:36 DenisChenu Status feedback => confirmed
2015-07-11 18:56 DenisChenu Changeset attached => LimeSurvey master 63c722de
2015-07-11 18:56 DenisChenu Note Added: 32671
2015-07-11 18:56 DenisChenu Resolution open => fixed
2015-07-11 19:06 DenisChenu Changeset attached => LimeSurvey develop 13f48a76
2015-07-11 19:06 DenisChenu Note Added: 32672
2015-07-11 19:06 DenisChenu Status confirmed => resolved
2015-07-11 19:06 DenisChenu Fixed in Version => 2.06+
2015-07-13 14:54 scottturnbull Note Added: 32675
2015-07-13 16:09 DenisChenu Note Added: 32676
2015-07-23 01:43 DenisChenu Relationship added has duplicate 09658
2015-07-24 11:44 c_schmitz Note Added: 32777
2015-07-24 11:44 c_schmitz Status resolved => closed