View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
16599Bug reportsQuestion editorpublic2020-12-14 11:19
Reporterfabianlehner Assigned Tocdorin  
PrioritynoneSeveritypartial_block 
Status closedResolutionno change required 
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
Bug heat4
Complete LimeSurvey version number (& build)4.3.10 (master)
I will donate to the project if issue is resolvedNo
Browser
Database type & versionPostgres 11
Server OS (if known)
Webserver software & version (if known)
PHP Version7.4.9

Users monitoring this issue

There are no users monitoring this issue.

Activities

fabianlehner

fabianlehner

2020-08-17 17:54

reporter   ~59490

duplicate 16313

cdorin

cdorin

2020-10-22 16:52

reporter   ~60369

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

cdorin

cdorin

2020-12-14 11:19

reporter   ~60941

No feedback provided

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
2020-12-14 11:19 cdorin Assigned To => cdorin
2020-12-14 11:19 cdorin Status feedback => closed
2020-12-14 11:19 cdorin Resolution open => no change required
2020-12-14 11:19 cdorin Note Added: 60941