View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
17630Bug reportsImport/Exportpublic2021-11-12 10:18
Reporterzufolo441 Assigned Toollehar  
PrioritynoneSeveritypartial_block 
Status assignedResolutionopen 
Product Version5.x 
Summary17630: unable to export to Excel survey with dual scale array
Description

Hi, when I try to export to Excel a survey with a dual scale question, I obtain the following error. This doesn't happen if I export to CSV:

PHP warning

Illegal string offset 'answer'

/var/www/html/limesurvey4/application/helpers/admin/export/SurveyObj.php(130)

118
119 case Question::QT_R_RANKING_STYLE: //RANKING TYPE
120 $fullAnswer = $answer;
121 break;
122
123 case Question::QT_1_ARRAY_MULTISCALE: //Array dual scale
124 if (mb_substr($fieldName, -1) == 0) {
125 $answers = $this->getAnswers($questionId, 0);
126 } else {
127 $answers = $this->getAnswers($questionId, 1);
128 }
129 if (array_key_exists($answerCode, $answers)) {
130 $fullAnswer = $answers[$answerCode]['answer'];
131 } else {
132 $fullAnswer = null;
133 }
134 break;
135
136 case Question::QT_L_LIST_DROPDOWN: //DROPDOWN LIST
137 case Question::QT_EXCLAMATION_LIST_DROPDOWN:
138 if (mb_substr($fieldName, -5, 5) == 'other') {
139 $fullAnswer = $answerCode;
140 } else {
141 if ($answerCode == '-oth-') {
142 $fullAnswer = $translator->translate('Other', $sLanguageCode);

Stack Trace
#0

/var/www/html/limesurvey4/application/helpers/admin/export/Writer.php(185): SurveyObj->getFullAnswer("566422X114X39281#0", "1", Translator, "it-qsnap")

180 @return string
181
/
182 public function getLongAnswer(SurveyObj $oSurvey, FormattingOptions $oOptions, $fieldName, $sValue)
183 {
184 return $this->transformResponseValue(
185 $oSurvey->getFullAnswer($fieldName, $sValue, $this->translator, $this->languageCode),
186 $oSurvey->fieldMap[$fieldName]['type'],
187 $oOptions,
188 $fieldName
189 );
190 }

#1

/var/www/html/limesurvey4/application/helpers/admin/export/Writer.php(323): Writer->getLongAnswer(SurveyObj, FormattingOptions, "566422X114X39281#0", "1")

318 foreach ($oOptions->selectedColumns as $column) {
319 $value = $aResponse[$column];
320 if (isset($oSurvey->fieldMap[$column]) && $oSurvey->fieldMap[$column]['type'] != 'answer_time' && $oSurvey->fieldMap[$column]['type'] != 'page_time' && $oSurvey->fieldMap[$column]['type'] != 'interview_time') {
321 switch ($oOptions->answerFormat) {
322 case 'long':
323 $elementArray[] = $this->getLongAnswer($oSurvey, $oOptions, $column, $value);
324 break;
325 default:
326 case 'short':
327 $elementArray[] = $this->getShortAnswer($oSurvey, $oOptions, $column, $value);
328 break;

#2

/var/www/html/limesurvey4/application/helpers/admin/exportresults_helper.php(119): Writer->write(SurveyObj, "it-qsnap", FormattingOptions, true)

114 $offset = $i * $maxRows;
115 $responsesQuery = $surveyDao->loadSurveyResults($survey, $oOptions->responseMinRecord, $oOptions->responseMaxRecord, $sFilter, $oOptions->responseCompletionState, $oOptions->selectedColumns, $oOptions->aResponses);
116 $responsesQuery->offset($offset);
117 $responsesQuery->limit($maxRows);
118 $survey->responses = $responsesQuery->query();
119 $writer->write($survey, $sLanguageCode, $oOptions, true);
120 }
121 $result = $writer->close();
122
123 // Close resultset if needed
124 if ($survey->responses instanceof CDbDataReader) {

TagsNo tags attached.
Bug heat4
Complete LimeSurvey version number (& build)5.1.14
I will donate to the project if issue is resolvedNo
BrowserFirefox
Database type & versionPostgreSQL 12
Server OS (if known)FreeBSD 13
Webserver software & version (if known)
PHP Version7.4

Users monitoring this issue

There are no users monitoring this issue.

Activities

ollehar

ollehar

2021-09-28 14:41

administrator   ~66632

What's the result when debug => 0 in config.php?

zufolo441

zufolo441

2021-09-28 14:57

reporter   ~66633

With debug => 0 it's working :-)

ollehar

ollehar

2021-09-28 15:25

administrator   ~66634

Last edited: 2021-09-28 15:26

And the exported data is correct too?

zufolo441

zufolo441

2021-09-30 13:38

reporter   ~66687

No, there are some "a".

Screenshot_20210930_133703.png (32,148 bytes)   
Screenshot_20210930_133703.png (32,148 bytes)   
Screenshot_20210930_133823.png (64,751 bytes)   
Screenshot_20210930_133823.png (64,751 bytes)   
Screenshot_20210930_133809.png (55,912 bytes)   
Screenshot_20210930_133809.png (55,912 bytes)   
zufolo441

zufolo441

2021-11-12 10:18

reporter   ~67271

Hi, is there some news about this bug? in 5.1.18 still persists.
I still didn't try in 5.2.1.
Many thanks!

Issue History

Date Modified Username Field Change
2021-09-28 10:36 zufolo441 New Issue
2021-09-28 14:41 ollehar Note Added: 66632
2021-09-28 14:41 ollehar Bug heat 0 => 2
2021-09-28 14:57 zufolo441 Note Added: 66633
2021-09-28 14:57 zufolo441 Bug heat 2 => 4
2021-09-28 15:25 ollehar Note Added: 66634
2021-09-28 15:26 ollehar Note Edited: 66634
2021-09-29 09:50 ollehar Assigned To => ollehar
2021-09-29 09:50 ollehar Status new => feedback
2021-09-30 13:38 zufolo441 Note Added: 66687
2021-09-30 13:38 zufolo441 File Added: Screenshot_20210930_133703.png
2021-09-30 13:38 zufolo441 File Added: Screenshot_20210930_133823.png
2021-09-30 13:38 zufolo441 File Added: Screenshot_20210930_133809.png
2021-09-30 13:38 zufolo441 Status feedback => assigned
2021-11-12 10:18 zufolo441 Note Added: 67271