View Issue Details

IDProjectCategoryView StatusLast Update
16599Bug reportsQuestion editorpublic2020-10-22 16:52
Reporterfabianlehner Assigned To 
Status feedbackResolutionopen 
Product Version4.3.10 
Summary16599: 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

see above

Additional Information

PR follows

Complete LimeSurvey version number (& build)4.3.10 (master)
I will donate to the project if issue is resolvedNo
Sync to Zoho Project
Database & DB-VersionPostgres 11
Server OS (if known)
Webserver software & version (if known)
PHP Version7.4.9




2020-08-17 17:54

reporter   ~59490

duplicate 16313



2020-10-22 16:52

manager   ~60369

Hey @fabianlehner , have you tried the fix provided in : ?

Issue History

Date Modified Username Field Change
2020-08-17 17:41 fabianlehner New Issue
2020-08-17 17:54 fabianlehner Note Added: 59490
2020-08-17 17:54 fabianlehner Tag Attached: duplicate
2020-10-22 16:52 cdorin Note Added: 60369
2020-10-22 16:52 cdorin Status new => feedback