View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|16599||Bug reports||Question editor||public||2020-08-17 17:41||2020-10-22 16:52|
|Summary||16599: Cannot update Answers (Type O) – Answer::checkUniqueness bug|
When trying to save from the question editor for a type O question, even if I haven't changed anything, I get an LSJsonException saying "Answer codes must be unique by question".
My research found that QuestionEditorController::storeAnswerOptions calls Answer::setAttributes with the bare string values from the request, which supposedly aren't correctly casted (aid, qid, scale_id should be int). Answer::checkUniqueness checks these against the (same, but int) values from the database, therefore fails to recognize that it's the same Answer object, and raises the above message.
Casting aid, qid and scale_id before setAttributes solves the problem.
|Steps To Reproduce|
|Complete LimeSurvey version number (& build)||4.3.10 (master)|
|I will donate to the project if issue is resolved||No|
|Sync to Zoho Project|
|Database & DB-Version||Postgres 11|
|Server OS (if known)|
|Webserver software & version (if known)|