View Issue Details

This bug affects 1 person(s).
 12
IDProjectCategoryView StatusLast Update
18655Bug reportsSurvey takingpublic2023-06-20 17:49
Reporterc_schmitz Assigned Toc_schmitz  
PriorityimmediateSeverityblock 
Status closedResolutionfixed 
Product Version5.6.x 
Summary18655: Data loss if field in response table is missing
Description

A customer of ours managed to activate a survey and added questions somehow after the survey was already activated.
We cannot reproduce that part, but for this issue it does not matter how this came to be.

Fact is that the survey had missing database fields, yet survey participants were still be able to fill out the survey, also saw the particular questions and were able to fill them out and going to the next page. However, the responses were not saved because the related fields in the response table was missing

Steps To Reproduce

Steps to reproduce

Create a survey with 2 groups and 2 questions each.
Activate the survey.
Edit the database and remove the field for the 1st question of the 1st group from the response table.
Fill out the survey.

Expected result

Throw an error that the response cannot be saved. Stop the participant from continuing the survey.

Actual result

Participant gets no error. Thinks that response was saved, continues to fill out the survey.

TagsNo tags attached.
Bug heat12
Complete LimeSurvey version number (& build)5.6.7
I will donate to the project if issue is resolvedNo
Browser
Database type & versionMySQL
Server OS (if known)
Webserver software & version (if known)
PHP Version8.0

Relationships

related to 18699 in code reviewollehar LSActiveRecord::getMaxId() doesn't get refreshed when using from SurveyDynamic with multiple surveys on the same HTTP request 

Users monitoring this issue

There are no users monitoring this issue.

Activities

c_schmitz

c_schmitz

2023-02-27 13:48

administrator   ~73963

@gabrieljenik Can you make this highest priority, please?

gabrieljenik

gabrieljenik

2023-02-27 14:16

manager   ~73964

@c_schmitz Already on it.
Quick question: Should we also add a "question <-> db field" validation when session starts?

c_schmitz

c_schmitz

2023-02-27 14:22

administrator   ~73965

Not sure, how much 'startup' time it would take, but yes, it is a good idea.

ollehar

ollehar

2023-02-27 15:21

administrator   ~73969

Edit the database

Doesn't this already break the contract of usage? Why would anyone expect it to work if you hack the database directly?

gabrieljenik

gabrieljenik

2023-02-27 16:16

manager   ~73971

PR: https://github.com/LimeSurvey/LimeSurvey/pull/2946

guest

guest

2023-02-27 23:18

viewer   ~73976

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

c_schmitz

c_schmitz

2023-02-28 22:19

administrator   ~73988

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

c_schmitz

c_schmitz

2023-02-28 22:26

administrator   ~73989

@gabrieljenik Had to revert this. This would break response export if a token table exists.

DenisChenu

DenisChenu

2023-03-01 07:47

developer   ~73990

This would break response export if a token table exists.

I don't understand why we use setAttributes when export ?

gabrieljenik

gabrieljenik

2023-03-01 20:59

manager   ~74002

New PR: https://github.com/LimeSurvey/LimeSurvey/pull/2956

LimeBot

LimeBot

2023-03-06 09:54

administrator   ~74036

Fixed in Release 5.6.9+230306

gabrieljenik

gabrieljenik

2023-03-17 14:51

manager   ~74166

@gabrieljenik Had to revert this. This would break response export if a token table exists.

There was no export responses with tokens test.
I have added a test.

https://github.com/LimeSurvey/LimeSurvey/pull/2998

guest

guest

2023-03-23 11:12

viewer   ~74244

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

guest

guest

2023-03-24 09:22

viewer   ~74273

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

ollehar

ollehar

2023-05-03 10:51

administrator   ~74770

This fix still does not investigate the cause of the bug at all. Might be related to restore response table while changing the survey structure?

DenisChenu

DenisChenu

2023-05-03 12:25

developer   ~74772

This fix still does not investigate the cause of the bug at all. Might be related to restore response table while changing the survey structure?

Really complex : can not be sure

But some current possibility
https://github.com/LimeSurvey/LimeSurvey/pull/3092

Fixed issue #18725: Reorder questions/question groups can break survey
https://bugs.limesurvey.org/view.php?id=18725

Needed for 5 and master (and 3.X maybe)

ollehar

ollehar

2023-05-03 13:04

administrator   ~74774

Really complex : can not be sure

Trying to reproduce would be a first step, I guess.

DenisChenu

DenisChenu

2023-05-03 14:38

developer   ~74781

Trying to reproduce would be a first step, I guess.

Maybe the issue on #8725 with reproducibility screen-cast on 5 and 6 ?

Related Changesets

LimeSurvey: master aa1a8876

2023-02-28 00:18

Gabriel Jenik

Committer: GitHub


Details Diff
Fixed issue 18655: Unnoticed data loss if field in response table it missing (#2946) Affected Issues
18655
mod - application/helpers/expressions/em_manager_helper.php Diff File
mod - application/models/Response.php Diff File

LimeSurvey: master e3f54b25

2023-02-28 23:19

c_schmitz


Details Diff
Revert "Fixed issue 18655: Unnoticed data loss if field in response table it missing (#2946)"

This reverts commit aa1a887617d76dc6e6a3ef212bc0bbf88b0e806e.
Affected Issues
18655
mod - application/helpers/expressions/em_manager_helper.php Diff File
mod - application/models/Response.php Diff File

LimeSurvey: master 022120fb

2023-03-23 12:11

Gabriel Jenik

Committer: GitHub


Details Diff
Fixed issue 18655: Data loss if field in response table it missing. (#2998)

Co-authored-by: Lapiu Dev <devgit@lapiu.biz>
Affected Issues
18655
mod - .github/workflows/main.yml Diff File
mod - application/helpers/remotecontrol/remotecontrol_handle.php Diff File
add - tests/data/surveys/survey_export_responses_with_tokens.lsa Diff File
add - tests/unit/helpers/remotecontrol/RemoteControlExportResponsesTest.php Diff File
mod - tests/unit/helpers/remotecontrol/RemoteControlTest.php Diff File
mod - tests/unit/models/QuestionGroupTest.php Diff File

LimeSurvey: master e4b4a76c

2023-03-24 10:22

Gabriel Jenik

Committer: GitHub


Details Diff
Fixed issue 18655: Data loss if field in response table it missing (#2956) Affected Issues
18655
mod - application/helpers/expressions/em_manager_helper.php Diff File
mod - application/models/Response.php Diff File

Issue History

Date Modified Username Field Change
2023-02-27 11:34 c_schmitz New Issue
2023-02-27 11:34 c_schmitz Assigned To => gabrieljenik
2023-02-27 11:34 c_schmitz Status new => assigned
2023-02-27 11:34 c_schmitz Priority none => immediate
2023-02-27 13:48 c_schmitz Note Added: 73963
2023-02-27 13:48 c_schmitz Bug heat 0 => 2
2023-02-27 13:59 c_schmitz Description Updated
2023-02-27 14:16 gabrieljenik Note Added: 73964
2023-02-27 14:16 gabrieljenik Bug heat 2 => 4
2023-02-27 14:22 c_schmitz Note Added: 73965
2023-02-27 15:21 ollehar Note Added: 73969
2023-02-27 15:21 ollehar Bug heat 4 => 6
2023-02-27 16:16 gabrieljenik Assigned To gabrieljenik => DenisChenu
2023-02-27 16:16 gabrieljenik Status assigned => ready for code review
2023-02-27 16:16 gabrieljenik Note Added: 73971
2023-02-27 17:00 gabrieljenik Issue cloned: 18657
2023-02-27 23:18 Changeset attached => LimeSurvey master aa1a8876
2023-02-27 23:18 guest Note Added: 73976
2023-02-27 23:18 guest Bug heat 6 => 8
2023-02-28 22:19 c_schmitz Changeset attached => LimeSurvey master e3f54b25
2023-02-28 22:19 c_schmitz Note Added: 73988
2023-02-28 22:19 c_schmitz Assigned To DenisChenu => c_schmitz
2023-02-28 22:19 c_schmitz Resolution open => fixed
2023-02-28 22:26 c_schmitz Assigned To c_schmitz => gabrieljenik
2023-02-28 22:26 c_schmitz Status ready for code review => assigned
2023-02-28 22:26 c_schmitz Note Added: 73989
2023-03-01 07:47 DenisChenu Note Added: 73990
2023-03-01 07:47 DenisChenu Bug heat 8 => 10
2023-03-01 20:59 gabrieljenik Assigned To gabrieljenik => DenisChenu
2023-03-01 20:59 gabrieljenik Status assigned => ready for code review
2023-03-01 20:59 gabrieljenik Note Added: 74002
2023-03-02 15:37 DenisChenu Assigned To DenisChenu => c_schmitz
2023-03-02 15:37 DenisChenu Status ready for code review => ready for testing
2023-03-06 09:54 LimeBot Note Added: 74036
2023-03-06 09:54 LimeBot Status ready for testing => closed
2023-03-06 09:54 LimeBot Bug heat 10 => 12
2023-03-06 09:57 DenisChenu Status closed => ready for testing
2023-03-06 11:08 ollehar Summary Data loss if field in response table it missing => Data loss if field in response table is missing
2023-03-17 14:51 gabrieljenik Note Added: 74166
2023-03-23 11:12 Changeset attached => LimeSurvey master 022120fb
2023-03-23 11:12 guest Note Added: 74244
2023-03-23 14:35 gabrieljenik Issue cloned: 18699
2023-03-23 14:35 gabrieljenik Relationship added related to 18699
2023-03-24 09:22 Changeset attached => LimeSurvey master e4b4a76c
2023-03-24 09:22 guest Note Added: 74273
2023-05-03 10:51 ollehar Note Added: 74770
2023-05-03 12:25 DenisChenu Note Added: 74772
2023-05-03 13:04 ollehar Note Added: 74774
2023-05-03 13:23 ollehar Status ready for testing => resolved
2023-05-03 14:38 DenisChenu Note Added: 74781
2023-06-20 17:49 c_schmitz Status resolved => closed