View Issue Details

This issue affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
20578Bug reportsSurvey editingpublic2026-06-30 12:09
ReporterOMdev Assigned To 
PrioritynoneSeverityblock 
Status newResolutionopen 
Product Version7.0.x 
Summary20578: Survey activation fails when a survey contains a Ranking question due to a consistency check error indicating missing answer opt
Description

Activating a survey containing a Ranking question triggers a consistency check error stating that the question has missing answer options, preventing the survey from being activated.

Steps To Reproduce

Steps to reproduce
Create a new survey in LS7 (LimeSurvey 7).
Add a Ranking question to the survey.
Save the survey and try to activate it.
Observe the error message displayed during survey activation.
Expected result

The survey should be activated successfully without any validation errors.

Actual result

The survey activation fails and the following error message is displayed:

Survey does not pass consistency check
Question qid-2483 ("Ranking"): This question has missing answer options.

As a result, the survey cannot be activated.

TagsNo tags attached.
Attached Files
issue.PNG (23,286 bytes)   
issue.PNG (23,286 bytes)   
Bug heat4
Complete LimeSurvey version number (& build)7.0.1+260611
I will donate to the project if issue is resolvedNo
BrowserChrome
Database type & versionNA
Server OS (if known)
Webserver software & version (if known)
PHP VersionNA

Users monitoring this issue

There are no users monitoring this issue.

Activities

Mazi

Mazi

2026-06-29 13:04

updater   ~85099

@tibor.pacalat: I can NOT reproduce this on our test system A using 7.0.5 which was set up from scratch.
But I CAN reprodce this at a system at which we went from 7.00 to 7.01 to 7.05. Has there been a certain fix applied recently and maybe our DB was not updated correctly during the update?

lajosarpad

lajosarpad

2026-06-29 14:02

developer   ~85101

This is happening at application/helpers/admin/activate_helper.php

due to this part:

    if ((int)$questionTypesMetaData[$chkrow['type']]['settings']->answerscales > 0) {
        for ($i = 0; $i < (int)$questionTypesMetaData[$chkrow['type']]['settings']->answerscales; $i++) {
            $chaquery = Yii::app()->db->createCommand()
                ->select('COUNT(aid)')
                ->from('{{answers}}')
                ->where('qid = :qid and scale_id=:scaleid', [':qid' => $chkrow['qid'], ':scaleid' => $i]);
            $chacount = $chaquery->queryScalar();
            if ($chacount == 0) {
                $failedcheck[] = array($chkrow['qid'], flattenText($chkrow['question'], true, true, 'utf-8', true), ": " . gT("This question has missing answer options."), $chkrow['gid']);
            }
        }
    }

It seems that script 703 was not executed at your end which has its purpose of updating question theme to expect subquestions to exist rather than answers because from now on ranking questions will have subquestions rather than answers to choose from. The error message clearly expected to have at least one answer whereas the correct expectation would be to have at least 1 subquestion. If you run

select * from lime_question_themes where question_type = 'R';

in your database you should find ranking and ranking_advanced and in the settings you should have something like this:

{"subquestions":"1","answerscales":"0","hasdefaultvalues":"0","assessable":"1","class":"ranking"}

where subquestions being 1 means we expect at least a subquestion to exist, whilst answerscales needs to be 0. Since you had it not being 0, you've got the validation issue you reported.

Mazi

Mazi

2026-06-29 14:14

updater   ~85102

@lajosarpad thanks a lot for this detailed analysis. That explains the problem very well.

Is there any way to execute script 703 to deal with the inconsistent database structure?

lajosarpad

lajosarpad

2026-06-30 10:01

developer   ~85119

A way to do that is to:

  1. Change version.php to have a higher value (increase it by one)
  2. Copy-paste the 703 script corresponding that number, maybe Update_709.php, but I did not double-check the number, so whatever number you have in version.php, that's the script number you need and in this copy the class name needs to be the same as the filename without the extension
  3. Reload an admin page and check these in the database
  4. Undo the change in version.php
  5. In the database you have a {{settings_global}} table that contains pairs of stg_name and stg_value, we are interested in the record whose stg_name is 'DBVersion'. The stg_number needs to be set to the one you have in version.php so future scripts will be executed
  6. Remove the temporary copy

Explanation:

  • version.php defines what the desired db version is
  • in {{settings_global}} the DBVersion record specifies what version you currently in
  • we artificially change version.php to want to update a future script (that we are about to temporarily create)
  • we create a copy of the script we wish to execute, renaming the class and the file accordingly
  • load a page to trigger the script
  • adjust version.php as well as {{settings_global}} so the script versioning will still work well in the future.
Mazi

Mazi

2026-06-30 12:09

updater   ~85129

@lajosarpad, thanks for this very helpful step-by-step list. This solved the problem. I think we can close the ticket.

Issue History

Date Modified Username Field Change
2026-06-27 12:48 OMdev New Issue
2026-06-27 12:48 OMdev File Added: issue.PNG
2026-06-29 13:04 Mazi Note Added: 85099
2026-06-29 13:04 Mazi Bug heat 0 => 2
2026-06-29 14:02 lajosarpad Note Added: 85101
2026-06-29 14:02 lajosarpad Bug heat 2 => 4
2026-06-29 14:14 Mazi Note Added: 85102
2026-06-30 10:01 lajosarpad Note Added: 85119
2026-06-30 12:09 Mazi Note Added: 85129