View Issue Details

This bug affects 1 person(s).
IDProjectCategoryView StatusLast Update
18146Bug reportsSurvey editingpublic2022-06-27 15:34
ReporterMazi Assigned Togabrieljenik  
Status ready for mergeResolutionopen 
Product Version5.3.x 
Summary18146: Using "other" as subquestion code at array questions leads to saving error

When trying to use "other" as subquestion code at an array question I get the below error message. The error message is misleading though:
"An error happened: Could not save subquestion Array ( [title] => Array ( [0] => 'other' can not be used if the 'Other' option for this question is activated. ) )"

-> There simply is no "other" option for array questions. So to make array filter work with e.g. a multi choice question with "other" field, it would be great if we could accept "other" as subquestion code for arrays.

Steps To Reproduce

Steps to reproduce

Create an array question and use "other" as subquestion code.

Expected result

Accept "other" as valid code.

Actual result

Misleading error message is shown about the "other" free text option which das not exist for this question type.

TagsNo tags attached.
Bug heat6
Complete LimeSurvey version number (& build)5.3.13
I will donate to the project if issue is resolvedNo
Database type & versionMariaDB 10.1.48
Server OS (if known)Ubuntu 18
Webserver software & version (if known)Apache 2.0
PHP Version7.4

Users monitoring this issue

User List There are no users monitoring this issue.




2022-05-24 14:41


image.png (77,759 bytes)   
image.png (77,759 bytes)   


2022-05-24 14:56

developer   ~69998

Seems parent question still have other == 'Y'

You can try to save as array before try again ?



2022-05-24 14:59

updater   ~69999

Hmm, we have switched this question from a single choice question into an array questions. Could this be some kind of left-over?



2022-05-24 15:03

developer   ~70000

Last edited: 2022-05-24 15:04

Surely a single choice with other …

But : i think other='N' must be resetted when you save
Else : we have this error in 3.X

Maybe you can check with 3.X

  1. Create a single choice Other == 'Y'
  2. Save it
  3. Update to array
  4. Add other for subquestions

Then : dev can check how it's done in 3.X



2022-05-24 15:07

updater   ~70001

At LS3 the error does NOT show up. I did the steps you described and could use "other" there.

image-2.png (11,518 bytes)   
image-2.png (11,518 bytes)   


2022-05-24 15:18

developer   ~70003

Thank you !



2022-05-26 19:39

developer   ~70061

Pull request :



2022-05-30 11:54

developer   ~70097

Improved pull request :



2022-06-09 23:35

manager   ~70337

Strange. I wasn't able to reproduce the issue on latest master (no patch applied).
@DenisChenu @Mazi Am I missing something?

image-3.png (37,694 bytes)   
image-3.png (37,694 bytes)   


2022-06-10 08:22

developer   ~70340

You must

Create a single choice Other == 'Y'
Save and close it
Update to array
Save and close it
Add other for subquestions
Save and close it

Other are not resetted if question type didn't allow other



2022-06-27 02:25

manager   ~70543

Tested OK. Haven't done regression testing.
Still considering the strange reproduction steps needed and the code updated, as to avoid regressions, I would send it to DEV as to have the code be sinked and lived for a while.



2022-06-27 10:09

developer   ~70547

I don't understand what you want it in DEV, there are no major recoding here. Just create some var in place of fixed test

Fixed test :

                ($oQuestion->type == Question::QT_L_LIST)
                || ($oQuestion->type == Question::QT_EXCLAMATION_LIST_DROPDOWN)
                || ($oQuestion->type == Question::QT_P_MULTIPLE_CHOICE_WITH_COMMENTS)
                || ($oQuestion->type == Question::QT_M_MULTIPLE_CHOICE)

Moving to a clean function

And add this rule :

        $aRules[] = array('other', 'filter', 'filter' => function ($value) {
            if ($this->getAllowOther()) {
                return $value;
            return 'N';

Already say : i prefer a good complete fix than create 4 bugs for the same file part …



2022-06-27 13:45

manager   ~70553

First of all, we had problems tying to reproduce it.
If you look at the steps for reproducing, they are not the usual path a user would do.
Also, I believe I tried couple of times, mixing "save" with "save and close" and wasn't able to reproduce it.
So, that's why I say it is not a very common issue.

Also, the PR is not just 2 blocks of changes, you are updating the definition for every question, re organizing how the title validations is done for all questions, .... Nevertheless the test is only a unit test about this fix.

At last as per "Already say : i prefer a good complete fix than create 4 bugs for the same file part …", I don't agree.
Doing bigger changes make issues harder to back-track, harder to test, more error prone, riskier to release, ...
We need to balance scope of fixing vs de-stabilization of the platform.
We are not perfect coders neither have the complete full view of the different situations that could arise.
So the least we update on a fix, sometimes is the better.



2022-06-27 15:01

developer   ~70560

Also, the PR is not just 2 blocks of changes, you are updating the definition for every question, re organizing how the title validations is done for all questions, .... Nevertheless the test is only a unit test about this fix.

See :
It's really 2 update … moving hardcoded definition to place where it need to be …



2022-06-27 15:05

manager   ~70561

Last edited: 2022-06-27 15:05

Well.. sometimes it is OK if we disagree :)



2022-06-27 15:34

developer   ~70565

You have some linefeed too , and moving

       /* Don't save empty or 'core' question theme name */
        $aRules[] = ['question_theme_name', 'questionThemeNameValidator'];

before if (!$this->isNewRecord) {

There are a related issue

Issue History

Date Modified Username Field Change
2022-05-24 14:41 Mazi New Issue
2022-05-24 14:41 Mazi File Added: image.png
2022-05-24 14:56 DenisChenu Note Added: 69998
2022-05-24 14:56 DenisChenu Bug heat 0 => 2
2022-05-24 14:59 Mazi Note Added: 69999
2022-05-24 14:59 Mazi Bug heat 2 => 4
2022-05-24 15:03 DenisChenu Note Added: 70000
2022-05-24 15:04 DenisChenu Note Edited: 70000
2022-05-24 15:07 Mazi Note Added: 70001
2022-05-24 15:07 Mazi File Added: image-2.png
2022-05-24 15:18 DenisChenu Note Added: 70003
2022-05-24 15:18 DenisChenu Assigned To => DenisChenu
2022-05-24 15:18 DenisChenu Status new => assigned
2022-05-26 19:39 DenisChenu Note Added: 70061
2022-05-26 19:39 DenisChenu Assigned To DenisChenu =>
2022-05-26 19:39 DenisChenu Status assigned => ready for testing
2022-05-30 11:54 DenisChenu Note Added: 70097
2022-06-03 22:57 gabrieljenik Assigned To => gabrieljenik
2022-06-03 22:57 gabrieljenik Status ready for testing => in testing
2022-06-09 23:35 gabrieljenik Note Added: 70337
2022-06-09 23:35 gabrieljenik File Added: image-3.png
2022-06-09 23:35 gabrieljenik Bug heat 4 => 6
2022-06-09 23:35 gabrieljenik Status in testing => feedback
2022-06-10 08:22 DenisChenu Note Added: 70340
2022-06-10 08:22 DenisChenu File Added: Capture d’écran du 2022-06-10 08-20-58.png
2022-06-27 02:25 gabrieljenik Status feedback => ready for merge
2022-06-27 02:25 gabrieljenik Note Added: 70543
2022-06-27 10:09 DenisChenu Note Added: 70547
2022-06-27 13:45 gabrieljenik Note Added: 70553
2022-06-27 15:01 DenisChenu Note Added: 70560
2022-06-27 15:05 gabrieljenik Note Added: 70561
2022-06-27 15:05 gabrieljenik Note Edited: 70561
2022-06-27 15:34 DenisChenu Note Added: 70565