View Issue Details

This issue affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
20690Bug reportsImport/Exportpublic2026-09-22 15:08
Reporterc_schmitz Assigned Toc_schmitz  
PrioritynoneSeverityminor 
Status closedResolutionfixed 
Product Version7.0.x 
Summary20690: Condition not properly converted when tryin to import LS5 lss file
Description

Condition not properly converted when tryin to import LS5 lss file

Steps To Reproduce

Steps to reproduce

Import attached .lss file

Expected result

File imports fine.

Actual result

Throws error

PHP warning

Attempt to read property "sid" on null

/var/www/html/limesurvey700/application/helpers/admin/import_helper.php(3224)

3212 } elseif (strpos($cfieldnameToProcess, 'X') !== false) {
3213 $parts = explode('X', $cfieldnameToProcess);
3214 $qid = null;
3215 $idCandidate = $parts[2];
3216 $search = true;
3217 $knownFieldName = null;
3218 $theQ = null;
3219 while ($search && strlen($idCandidate)) {
3220 foreach ($aQuestionsMapping as $key => $value) {
3221 if (($key === "Q{$idCandidate}") || (strpos($key, "Q{$idCandidate}") !== false)) {
3222 $qid = substr(explode("
", $value)[0], 1);
3223 $theQ = Question::model()->findByPk($qid);
3224 $theQuestions = Question::model()->findAll(['condition' => "sid = {$theQ->sid} and gid = {$theQ->gid} and {$theQ->qid} in (qid, parentqid)"]);
3225 $knownFieldName = "{$theQ->sid}X{$theQ->gid}X{$theQ->qid}" . substr($parts[2], strlen($idCandidate));
3226 $search = false;
3227 }
3228 }
3229 if ($search) {
3230 $idCandidate = substr($idCandidate, 0, strlen($idCandidate) - 1);
3231 }
3232 }
3233 if ($qid) {
3234 $insertdata['cfieldname'] = $plusPrefix . getFieldName(Yii::app()->db->tablePrefix . "responses
" . $theQ->sid, $knownFieldName, $theQuestions, $theQ->sid, $theQ->gid);
3235 }
3236 }

Stack Trace
#0
–
/var/www/html/limesurvey700/application/helpers/admin/import_helper.php(1400): XMLImportSurvey("/var/www/html/limesurvey700/tmp/jcyxbb4k4fsb6usrx23jy6yrcm2t8h.l...", "<?xml version="1.0" encoding="UTF-8"?> <document> <LimeSurveyDo...", null, null, ...)

1395 } else {
1396 $sExtension = "";
1397 }
1398 switch ($sExtension) {
1399 case 'lss':
1400 $aImportResults = XMLImportSurvey($sFullFilePath, null, $sNewSurveyName, $DestSurveyID, $bTranslateLinksFields, true, $targetSurveyGroup);
1401 if (!empty($aImportResults['newsid'])) {
1402 $SurveyIntegrity = new LimeSurvey\Models\Services\SurveyIntegrity(Survey::model()->findByPk($aImportResults['newsid']));
1403 $SurveyIntegrity->fixSurveyIntegrity();
1404 finalizeSurveyImportFile($aImportResults['newsid'], $baselang);
1405 }

TagsNo tags attached.
Attached Files
survey_946238.lss (1,152,197 bytes)
Bug heat4
Complete LimeSurvey version number (& build)7.1.0
I will donate to the project if issue is resolvedNo
Browser
Database type & version.
Server OS (if known)
Webserver software & version (if known)
PHP Version.

Users monitoring this issue

There are no users monitoring this issue.

Activities

c_schmitz

c_schmitz

2026-09-22 11:33

administrator   ~85921

Files predating DBVersion 339 repeat each question/subquestion row once per language directly inside <questions>/<subquestions> instead of using a separate question_l10ns section.
The question/subquestion mapping used to build condition cfieldnames was populated from the in-memory Question object, which is only ever saved on the first (non-duplicate) row; on every repeat-language row it was a fresh, unsaved instance, so its qid was empty and clobbered the correct mapping entry recorded earlier.
This made getFieldName() resolve against a non-existent question, causing "Attempt to read property 'sid' on null" and aborting the import.

c_schmitz

c_schmitz

2026-09-22 11:37

administrator   ~85922

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=40476

LimeBot

LimeBot

2026-09-22 15:08

administrator   ~85924

Fixed in Release 7.3.0+260922

Related Changesets

LimeSurvey: master 9843891d

2026-09-22 11:37

c_schmitz


Details Diff
Fixed issue 20690: Condition not properly converted when importing legacy LSS files from version 3 or earlier Affected Issues
20690
mod - application/helpers/admin/import_helper.php Diff File

Issue History

Date Modified Username Field Change
2026-09-14 11:59 c_schmitz New Issue
2026-09-14 11:59 c_schmitz File Added: survey_946238.lss
2026-09-22 11:32 c_schmitz Assigned To => c_schmitz
2026-09-22 11:32 c_schmitz Status new => assigned
2026-09-22 11:33 c_schmitz Note Added: 85921
2026-09-22 11:33 c_schmitz Bug heat 0 => 2
2026-09-22 11:37 c_schmitz Changeset attached => LimeSurvey master 9843891d
2026-09-22 11:37 c_schmitz Note Added: 85922
2026-09-22 11:37 c_schmitz Status assigned => resolved
2026-09-22 11:37 c_schmitz Resolution open => fixed
2026-09-22 15:08 LimeBot Note Added: 85924
2026-09-22 15:08 LimeBot Status resolved => closed
2026-09-22 15:12 Freda Bug heat 2 => 4