View Issue Details

IDProjectCategoryView StatusLast Update
16145Bug reportsSurvey editingpublic2020-07-29 22:44
ReporterPedaBa Assigned To 
PrioritynormalSeveritycrash 
Status closedResolutionno change required 
Product Version4.1.13 
Summary16145: Can't save modified questions
Description

In my current setup (testing instance, two testing surveys with dummy questions with List (radio) Type L) I can not (directly) save modified questions. As soon as I try to modify the question text and press save, I get a blue box stating "Question cannot be stored. Please check the answer options for duplicates or empty codes."

There are some site-notes:

  1. I don't know if this behaviour existed from the beginning or after I first added a question with part of the text being "int main(int argc, char **argv) { ... }". After this, LS complaint that "{ ... }" is no valid variable (or something like that) and after trying to change this text, I couldn't save it anylonger.
  2. If I do any change to the question text and afterwards delete all answers, I can save. The question is changed, the answers stay like they had been initially
  3. If I do any change to the question and delete one answer, I can save. The question changed but still all original answers are visible in "preview question". If I edit again, the aforementioned answer is gone and still displays in "preview question"
Steps To Reproduce

Use a fresh install. Create a single survey. Add 2 groups, 2 questions (List (radio) Type L) per group. Simple question text + 4 answers each. Add some this to one of the questions "int main(int argc, char **argv) { printf("Hello World\n"); }". Save, preview question (you'll get an error about non-found variable). Edit question and try to save.

Additional Information

Assessment was activated, everything else pretty default. Vanilla layout.

TagsNo tags attached.
Complete LimeSurvey version number (& build)Version 4.1.13+200325
I will donate to the project if issue is resolvedNo
BrowserChromium
Database & DB-Versionmysql 5.6-r12
Server OS (if known)Gentoo
Webserver software & version (if known)apache 2.4.41
PHP Version7.0.32

Activities

davidrgl

davidrgl

2020-04-21 21:51

reporter   ~57298

we are having an issue that i feel may be similar, so I thought i would add some information assuming it is.
We are simply trying to add answer options, or change the order, or anything, and it will not save. It throws a 500 error I am pasting below, complaining about unique answer option codes. However, they are unique. As it only lets one answer option exist, i found i can bulk add them if removing everything, but then any changes and the issues reoccurs.
We are using postgres as the database back end.

{"success":false,"message":"Question has been stored, but an error happened: \nAnswer option couldn't be saved. Error: Array\n(\n [code] => Array\n (\n [0] => Answer codes must be unique by question\n )\n\n)\n","error":{"code":500,"type":"LSJsonException","errorCode":0,"message":"Question has been stored, but an error happened: \nAnswer option couldn't be saved. Error: Array\n(\n [code] => Array\n (\n [0] => Answer codes must be unique by question\n )\n\n)\n","file":"\/var\/www\/html\/application\/controllers\/admin\/questionedit.php","line":297,"trace":"#0 [internal function]: questionedit->saveQuestionData()\n#1 \/var\/www\/html\/framework\/web\/actions\/CAction.php(109): ReflectionMethod->invokeArgs()\n#2 \/var\/www\/html\/application\/core\/Survey_Common_Action.php(86): CAction->runWithParamsInternal()\n#3 \/var\/www\/html\/framework\/web\/CController.php(308): Survey_Common_Action->runWithParams()\n#4 \/var\/www\/html\/framework\/web\/CController.php(286): CController->runAction()\n#5 \/var\/www\/html\/framework\/web\/CController.php(265): CController->runActionWithFilters()\n#6 \/var\/www\/html\/application\/controllers\/AdminController.php(180): CController->run()\n#7 \/var\/www\/html\/framework\/web\/CWebApplication.php(282): AdminController->run()\n#8 \/var\/www\/html\/framework\/web\/CWebApplication.php(141): CWebApplication->runController()\n#9 \/var\/www\/html\/framework\/base\/CApplication.php(185): CWebApplication->processRequest()\n#10 \/var\/www\/html\/index.php(182): CApplication->run()\n#11 {main}","traces":[{"function":"saveQuestionData","class":"questionedit","type":"->","file":"unknown","line":0},{"file":"\/var\/www\/html\/framework\/web\/actions\/CAction.php","line":109,"function":"invokeArgs","class":"ReflectionMethod","type":"->"},{"file":"\/var\/www\/html\/application\/core\/Survey_Common_Action.php","line":86,"function":"runWithParamsInternal","class":"CAction","type":"->"},{"file":"\/var\/www\/html\/framework\/web\/CController.php","line":308,"function":"runWithParams","class":"Survey_Common_Action","type":"->"},{"file":"\/var\/www\/html\/framework\/web\/CController.php","line":286,"function":"runAction","class":"CController","type":"->"},{"file":"\/var\/www\/html\/framework\/web\/CController.php","line":265,"function":"runActionWithFilters","class":"CController","type":"->"},{"file":"\/var\/www\/html\/application\/controllers\/AdminController.php","line":180,"function":"run","class":"CController","type":"->"},{"file":"\/var\/www\/html\/framework\/web\/CWebApplication.php","line":282,"function":"run","class":"AdminController","type":"->"},{"file":"\/var\/www\/html\/framework\/web\/CWebApplication.php","line":141,"function":"runController","class":"CWebApplication","type":"->"},{"file":"\/var\/www\/html\/framework\/base\/CApplication.php","line":185,"function":"processRequest","class":"CWebApplication","type":"->"},{"file":"\/var\/www\/html\/index.php","line":182,"function":"run","class":"CApplication","type":"->"}]},"redirectTo":"\/index.php\/admin\/questioneditor\/sa\/view\/surveyid\/546757\/gid\/8\/qid\/33"}

ollehar

ollehar

2020-04-22 11:07

administrator   ~57309

Please update to the latest version and try again. Thank you.

davidrgl

davidrgl

2020-04-22 16:20

reporter   ~57321

No change in my case after upgrading this morning. if it isnt actually related i can open a new bug report.

Same 500 error:

{"JSON":{"success":false,"message":"Question has been stored, but an error happened: \nAnswer option couldn't be saved. Error: Array\n(\n [code] => Array\n (\n [0] => Answer codes must be unique by question\n )\n\n)\n","error":{"code":500,"type":"LSJsonException","errorCode":0,"message":"Question has been stored, but an error happened: \nAnswer option couldn't be saved. Error: Array\n(\n [code] => Array\n (\n [0] => Answer codes must be unique by question\n )\n\n)\n","file":"/var/www/html/application/controllers/admin/questionedit.php","line":297,"trace":"#0 [internal function]: questionedit->saveQuestionData()\n#1 /var/www/html/framework/web/actions/CAction.php(109): ReflectionMethod->invokeArgs()\n#2 /var/www/html/application/core/Survey_Common_Action.php(86): CAction->runWithParamsInternal()\n#3 /var/www/html/framework/web/CController.php(308): Survey_Common_Action->runWithParams()\n#4 /var/www/html/framework/web/CController.php(286): CController->runAction()\n#5 /var/www/html/framework/web/CController.php(265): CController->runActionWithFilters()\n#6 /var/www/html/application/controllers/AdminController.php(180): CController->run()\n#7 /var/www/html/framework/web/CWebApplication.php(282): AdminController->run()\n#8 /var/www/html/framework/web/CWebApplication.php(141): CWebApplication->runController()\n#9 /var/www/html/framework/base/CApplication.php(185): CWebApplication->processRequest()\n#10 /var/www/html/index.php(182): CApplication->run()\n#11 {main}","traces":[{"function":"saveQuestionData","class":"questionedit","type":"->","file":"unknown","line":0},{"file":"/var/www/html/framework/web/actions/CAction.php","line":109,"function":"invokeArgs","class":"ReflectionMethod","type":"->"},{"file":"/var/www/html/application/core/Survey_Common_Action.php","line":86,"function":"runWithParamsInternal","class":"CAction","type":"->"},{"file":"/var/www/html/framework/web/CController.php","line":308,"function":"runWithParams","class":"Survey_Common_Action","type":"->"},{"file":"/var/www/html/framework/web/CController.php","line":286,"function":"runAction","class":"CController","type":"->"},{"file":"/var/www/html/framework/web/CController.php","line":265,"function":"runActionWithFilters","class":"CController","type":"->"},{"file":"/var/www/html/application/controllers/AdminController.php","line":180,"function":"run","class":"CController","type":"->"},{"file":"/var/www/html/framework/web/CWebApplication.php","line":282,"function":"run","class":"AdminController","type":"->"},{"file":"/var/www/html/framework/web/CWebApplication.php","line":141,"function":"runController","class":"CWebApplication","type":"->"},{"file":"/var/www/html/framework/base/CApplication.php","line":185,"function":"processRequest","class":"CWebApplication","type":"->"},{"file":"/var/www/html/index.php","line":182,"function":"run","class":"CApplication","type":"->"}]},"redirectTo":"/index.php/admin/questioneditor/sa/view/surveyid/546757/gid/8/qid/33"},"Response Payload":{"EDITOR_CONFIG":{"text":"{\"success\":false,\"message\":\"Question has been stored, but an error happened: \nAnswer option couldn't be saved. Error: Array\n(\n [code] => Array\n (\n [0] => Answer codes must be unique by question\n )\n\n)\n\",\"error\":{\"code\":500,\"type\":\"LSJsonException\",\"errorCode\":0,\"message\":\"Question has been stored, but an error happened: \nAnswer option couldn't be saved. Error: Array\n(\n [code] => Array\n (\n [0] => Answer codes must be unique by question\n )\n\n)\n\",\"file\":\"\/var\/www\/html\/application\/controllers\/admin\/questionedit.php\",\"line\":297,\"trace\":\"#0 [internal function]: questionedit->saveQuestionData()\n#1 \/var\/www\/html\/framework\/web\/actions\/CAction.php(109): ReflectionMethod->invokeArgs()\n#2 \/var\/www\/html\/application\/core\/Survey_Common_Action.php(86): CAction->runWithParamsInternal()\n#3 \/var\/www\/html\/framework\/web\/CController.php(308): Survey_Common_Action->runWithParams()\n#4 \/var\/www\/html\/framework\/web\/CController.php(286): CController->runAction()\n#5 \/var\/www\/html\/framework\/web\/CController.php(265): CController->runActionWithFilters()\n#6 \/var\/www\/html\/application\/controllers\/AdminController.php(180): CController->run()\n#7 \/var\/www\/html\/framework\/web\/CWebApplication.php(282): AdminController->run()\n#8 \/var\/www\/html\/framework\/web\/CWebApplication.php(141): CWebApplication->runController()\n#9 \/var\/www\/html\/framework\/base\/CApplication.php(185): CWebApplication->processRequest()\n#10 \/var\/www\/html\/index.php(182): CApplication->run()\n#11 {main}\",\"traces\":[{\"function\":\"saveQuestionData\",\"class\":\"questionedit\",\"type\":\"->\",\"file\":\"unknown\",\"line\":0},{\"file\":\"\/var\/www\/html\/framework\/web\/actions\/CAction.php\",\"line\":109,\"function\":\"invokeArgs\",\"class\":\"ReflectionMethod\",\"type\":\"->\"},{\"file\":\"\/var\/www\/html\/application\/core\/Survey_Common_Action.php\",\"line\":86,\"function\":\"runWithParamsInternal\",\"class\":\"CAction\",\"type\":\"->\"},{\"file\":\"\/var\/www\/html\/framework\/web\/CController.php\",\"line\":308,\"function\":\"runWithParams\",\"class\":\"Survey_Common_Action\",\"type\":\"->\"},{\"file\":\"\/var\/www\/html\/framework\/web\/CController.php\",\"line\":286,\"function\":\"runAction\",\"class\":\"CController\",\"type\":\"->\"},{\"file\":\"\/var\/www\/html\/framework\/web\/CController.php\",\"line\":265,\"function\":\"runActionWithFilters\",\"class\":\"CController\",\"type\":\"->\"},{\"file\":\"\/var\/www\/html\/application\/controllers\/AdminController.php\",\"line\":180,\"function\":\"run\",\"class\":\"CController\",\"type\":\"->\"},{\"file\":\"\/var\/www\/html\/framework\/web\/CWebApplication.php\",\"line\":282,\"function\":\"run\",\"class\":\"AdminController\",\"type\":\"->\"},{\"file\":\"\/var\/www\/html\/framework\/web\/CWebApplication.php\",\"line\":141,\"function\":\"runController\",\"class\":\"CWebApplication\",\"type\":\"->\"},{\"file\":\"\/var\/www\/html\/framework\/base\/CApplication.php\",\"line\":185,\"function\":\"processRequest\",\"class\":\"CWebApplication\",\"type\":\"->\"},{\"file\":\"\/var\/www\/html\/index.php\",\"line\":182,\"function\":\"run\",\"class\":\"CApplication\",\"type\":\"->\"}]},\"redirectTo\":\"\/index.php\/admin\/questioneditor\/sa\/view\/surveyid\/546757\/gid\/8\/qid\/33\"}","mode":"application/json"}}}

cdorin

cdorin

2020-05-06 16:10

manager   ~57594

Can you please send us the .lss file? Is somehow random order enabled?

davidrgl

davidrgl

2020-05-06 19:43

reporter   ~57599

For my case it happens on every survey, but i attached the one that started us on the journey. Random is not on.

surveys_archive(1).zip (5,319 bytes)
ollehar

ollehar

2020-05-07 12:13

administrator   ~57604

It's because of the {} in the question text. LimeSurvey things it's an expression and tries to evaluate it. Did this work in LS3?

larjona

larjona

2020-05-20 13:07

reporter   ~57954

Hi, I have a similar issue which I have reported in https://bugs.limesurvey.org/view.php?id=16313 (can only add answer options or modify the present ones by changing the question codes to new ones)

cdorin

cdorin

2020-07-29 22:44

manager   ~59178

I closed this ticket since no feedback has been provided.

I marked 16313 as confirmed.

Issue History

Date Modified Username Field Change
2020-04-16 22:38 PedaBa New Issue
2020-04-21 21:51 davidrgl Note Added: 57298
2020-04-22 11:07 ollehar Note Added: 57309
2020-04-22 11:07 ollehar Status new => feedback
2020-04-22 16:20 davidrgl Note Added: 57321
2020-05-06 16:10 cdorin Note Added: 57594
2020-05-06 19:43 davidrgl Note Added: 57599
2020-05-06 19:43 davidrgl File Added: surveys_archive(1).zip
2020-05-07 12:13 ollehar Note Added: 57604
2020-05-07 12:13 ollehar Priority none => normal
2020-05-07 12:13 ollehar Severity partial_block => crash
2020-05-20 13:07 larjona Note Added: 57954
2020-07-29 22:44 cdorin Status feedback => closed
2020-07-29 22:44 cdorin Resolution open => no change required
2020-07-29 22:44 cdorin Note Added: 59178