TypeError

Cannot access offset of type string on string

/limeservice/instances/25/limesurvey/application/core/plugins/ExportSTATAxml/STATAxmlWriter.php(130)

118         }
119         $aFieldmap['answers'] = array_intersect_key($survey->answers, array_flip($aUsedQIDs));
120 
121         // add per-survey info
122         $aFieldmap['info'] = $survey->info;
123 
124         // STATA only uses value labels on numerical variables. If the answer codes are not numerical we later replace them with the text-answer
125         // here we go through the answers-array and check whether answer-codes are numerical. If they are not, we save the respective QIDs
126         // so responses can later be set to full answer test of Question or SQ'
127         foreach ($aFieldmap['answers'] as $qid => $aScale) {
128             foreach ($aFieldmap['answers'][$qid] as $iScale => $aAnswers) {
129                 foreach ($aFieldmap['answers'][$qid][$iScale] as $iAnswercode => $aAnswer) {
130                     if (!is_numeric($aAnswer['code'])) {
131                         $this->aQIDnonumericalAnswers[$aAnswer['qid']] = true;
132                     }
133                 }
134             }
135         }
136 
137         // go through the questions array and create/modify vars for STATA-output
138         foreach ($aFieldmap['questions'] as $sSGQAkey => $aQuestion) {
139             // STATA does not support attaching value labels to non-numerical values
140             // We therefore set a flag in questions array for non-numerical answer codes.
141             // The respective codes are later recoded to contain the full answers
142             if (array_key_exists($aQuestion['qid'], $this->aQIDnonumericalAnswers)) {

Stack Trace

#0
+
 /limeservice/instances/25/limesurvey/application/core/plugins/ExportSTATAxml/STATAxmlWriter.php(62): STATAxmlWriter->createStataFieldmap(SurveyObj, "de", FormattingOptions)
57             $this->handle = fopen($this->filename, 'w');
58         }
59         $this->headersSGQA       = $oOptions->selectedColumns;
60         $oOptions->headingFormat = 'code'; // Always use fieldcodes
61 
62         $this->customFieldmap = $this->createStataFieldmap($survey, $sLanguageCode, $oOptions);
63     }
64 
65 
66     /**
67      * @param string $content
#1
+
 /limeservice/instances/25/limesurvey/application/helpers/admin/exportresults_helper.php(108): STATAxmlWriter->init(SurveyObj, "de", FormattingOptions)
103             throw new Exception(sprintf('Writer for %s should implement IWriter', $sExportPlugin));
104         }
105 
106         $surveyDao = new SurveyDao();
107         $survey = $surveyDao->loadSurveyById($iSurveyId, $sLanguageCode, $oOptions);
108         $writer->init($survey, $sLanguageCode, $oOptions);
109 
110         $countResponsesCommand = $surveyDao->loadSurveyResults($survey, $oOptions->responseMinRecord, $oOptions->responseMaxRecord, $sFilter, $oOptions->responseCompletionState, $oOptions->selectedColumns, $oOptions->aResponses);
111         $countResponsesCommand->order = null;
112         $countResponsesCommand->select('count(*)');
113         $responseCount = $countResponsesCommand->queryScalar();
#2
+
 /limeservice/instances/25/limesurvey/application/controllers/admin/Export.php(359): ExportSurveyResultsService->exportResponses(289415, "de", "stataxml", FormattingOptions, ...)
354         } else {
355             $sFilter = '';
356         }
357 
358         viewHelper::disableHtmlLogging();
359         $resultsService->exportResponses($iSurveyID, $explang, $sExportType, $options, $sFilter);
360 
361         Yii::app()->end();
362     }
363 
364     /**
2023-01-20 16:25:12 nginx/1.18.0 Yii Framework/1.1.26