View Issue Details

IDProjectCategoryView StatusLast Update
16599Bug reportsQuestion editorpublic2020-10-22 16:52
Reporterfabianlehner Assigned To 
PrioritynoneSeveritypartial_block 
Status feedbackResolutionopen 
Product Version4.3.10 
Summary16599: Cannot update Answers (Type O) – Answer::checkUniqueness bug
Description

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

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

Activities

fabianlehner

fabianlehner

2020-08-17 17:54

reporter   ~59490

duplicate 16313

cdorin

cdorin

2020-10-22 16:52

manager   ~60369

Hey @fabianlehner , have you tried the fix provided in : https://bugs.limesurvey.org/view.php?id=16313 ?

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