View Issue Details

This bug affects 1 person(s).
 14
IDProjectCategoryView StatusLast Update
16566Bug reportsSurvey editingpublic2020-08-17 14:05
Reporterestupendu Assigned Togabrieljenik  
PriorityhighSeverityblock 
Status closedResolutionfixed 
Product Version4.3.8 
Summary16566: We cannot create multiple choice questions
Description

When we create a multiple choice questions this error appears in postgres log:

ERROR: invalid input syntax for integer: "random3l4waqd" at character 67
STATEMENT: SELECT * FROM "lime_questions" "t" WHERE sid = '616628' AND qid = 'random3l4waqd' LIMIT 1

TagsNo tags attached.
Bug heat14
Complete LimeSurvey version number (& build)Version 4.3.8+200803
I will donate to the project if issue is resolvedNo
BrowserChrome
Database type & versionPostgreSQL 9.5
Server OS (if known)Linux Centos
Webserver software & version (if known)
PHP Version7.3.13

Relationships

related to 16563 closedcdorin We cannot create a new question and Limesurvey deletes some answers 

Users monitoring this issue

medhat

Activities

cdorin

cdorin

2020-08-04 15:57

reporter   ~59289

Is it only with multiple choice? Seems I cannot create any question type if I switch to pgsql 10.12

estupendu

estupendu

2020-08-04 16:09

reporter   ~59291

Last edited: 2020-08-13 10:48

It is not with multiple choice. See another bug report: 16563

medhat

medhat

2020-08-05 06:53

reporter   ~59316

Last edited: 2020-08-13 10:48

I have the same problem with for both multiple choice & array questions.

sub-questions are not being saved and a red empty box appears when trying to save (a screenshot is attached)

My configuration: (LS version 4.3.5+200721 - PHP 7.2.1 - Database: MS SQL Server 2016)

multiple choice error.jpg (198,064 bytes)
gabrieljenik

gabrieljenik

2020-08-10 18:34

manager   ~59396

Last edited: 2020-08-13 10:48

Random characters sometimes could come on qid when creating new questions as those are used by vue to identify internally new rows.

Before issue 16469, QuestionEditorController tried to find the questions using 'findByPk', which automatically casts the value to int, removing characters.

Now, 'find' is used because the survey ID is added to the search criterias.
qid is not casted and no objects are found.

When saving a new question, Question object is empty, and the resulting SQL fails in Postgres because of the data type.
Solved by casting 'qid' to int.

PR: https://github.com/LimeSurvey/LimeSurvey/pull/1543
Contains both fix for 16566 and 16563

user225042

2020-08-12 14:06

  ~59444

Last edited: 2020-08-13 10:48

Tested the issue before pulling the PR, Issue exist. Tested the issue after pulling the PR, below are my findings:
Screenshot 1:Before PR, the question is not been created and a red top bar is displayed
Screenshot 2:After PR, the question is been created and saved successfully and is displayed

Please refer the attachment for more details, working as expected

gabrieljenik

gabrieljenik

2020-08-12 17:50

manager   ~59452

Last edited: 2020-08-13 10:48

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=30372

lime_release_bot

lime_release_bot

2020-08-17 14:05

administrator   ~59471

Fixed in Release 4.3.11+200817

Related Changesets

LimeSurvey: master 16425fff

2020-08-12 17:50:51

gabrieljenik


Committer: GitHub Details Diff
Fixed issue 16566: We cannot create multiple choice questions (#1543)

Dev: Before issue 16469, QuestionEditorController tried to find the questions using 'findByPk', which automatically casts the value to int. Now, 'find' is used because the survey ID, as the search is done by multiple criterias.
Dev: When saving a new question, 'qid' is an empty string, and the resulting SQL fails in Postgres because of the data type. Solved by casting 'qid' to int.
Dev: This also helps with issue 16563.
Dev: Casting subquestion id as to remove the random characters vue id adds for its view.
Affected Issues
16469, 16563, 16566
mod - application/controllers/QuestionEditorController.php Diff File

Issue History

Date Modified Username Field Change
2020-08-04 10:43 estupendu New Issue
2020-08-04 15:57 cdorin Note Added: 59289
2020-08-04 15:57 cdorin Priority none => high
2020-08-04 15:57 cdorin Status new => confirmed
2020-08-04 15:57 cdorin Zoho Sprints => |Yes|
2020-08-04 15:57 swendrich Zoho Sprints ID => 14469000000204049
2020-08-04 16:09 estupendu Note Added: 59291
2020-08-05 06:53 medhat Note Added: 59316
2020-08-05 06:53 medhat File Added: multiple choice error.jpg
2020-08-05 06:55 medhat Issue Monitored: medhat
2020-08-10 18:27 gabrieljenik Relationship added related to 16563
2020-08-10 18:34 gabrieljenik Note Added: 59396
2020-08-12 14:06 user225042 Note Added: 59444
2020-08-12 14:06 user225042 File Added: 16566_Posgres_Createquestion.png
2020-08-12 17:50 gabrieljenik Changeset attached => LimeSurvey master 16425fff
2020-08-12 17:50 gabrieljenik Note Added: 59452
2020-08-12 17:50 gabrieljenik Assigned To => gabrieljenik
2020-08-12 17:50 gabrieljenik Resolution open => fixed
2020-08-13 10:48 swendrich Zoho Sprints Yes => |Yes|
2020-08-13 10:48 swendrich Status confirmed => resolved
2020-08-17 14:05 lime_release_bot Zoho Sprints Yes => |Yes|
2020-08-17 14:05 lime_release_bot Note Added: 59471
2020-08-17 14:05 lime_release_bot Status resolved => closed
2021-08-02 18:51 guest Bug heat 12 => 14