View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
16708 | Bug reports | Statistics | public | 2020-09-30 08:44 | 2020-10-12 09:28 |
Reporter | annighoefer | Assigned To | gabrieljenik | ||
Priority | none | Severity | minor | ||
Status | closed | Resolution | fixed | ||
Product Version | 4.3.16 | ||||
Summary | 16708: php error in statistics view | ||||
Description | Hello, i get an error if I wanna see statistics in simple mode of a survey. | ||||
Steps To Reproduce | The error can be reproduced by following these steps:
| ||||
Additional Information | The problem is, parent question and subquestions are different types (Parent (L), Subquestion (F)). The data integrity check sets the type of subquestion equal to parent question. This means, the subquestion is of type L now. This happens in function fixSubQuestions() located in Question.php. I think statistics can't handle subquestions of type L or other types. | ||||
Tags | No tags attached. | ||||
Attached Files | |||||
Bug heat | 4 | ||||
Complete LimeSurvey version number (& build) | 4.3.16+202009 | ||||
I will donate to the project if issue is resolved | No | ||||
Browser | |||||
Database type & version | MySQL [5.5.5-10.1.45-MariaDB-0+deb9u1] | ||||
Server OS (if known) | 18.04.1-Ubuntu | ||||
Webserver software & version (if known) | Apache | ||||
PHP Version | 7.2.33 | ||||
https://github.com/LimeSurvey/LimeSurvey/pull/1616 DiagnosisAccording to the description of the issue we believe to be caused by a combination of errors: 1) When changing the type of a question from a type with subquestions to a type without subquestions (ex: from Array to List), the subquestions are not removed from the DB. The subquestions remain in the table with the old type. 2) Check Integrity processes these "orphan" subquestions making sure they match the parent question's type, without checking if it's actually correct for that type to have subquestions. So, it updates the subquestions while it should remove them. I think both actions should check the question type definition (QuestionType attributes) and, if the 'subquestions' attribute is false, remove the subquestions from the DB. Solution1) Override 'update' method in Question model to delete existing subquestions if the question's type doesn't allow them. 2) Updated saveQuestionData action to avoid saving subquestions if the question's type doesn't allow them (because the subquestions are part the POST if they exist in the original question). 3) Updated common_helper's 'fixSubquestions' (used by check integrity) to do the same as mentioned in point 1. Note that 'fixSubquestions' only processes subquestions where the type is not the same as the parent question. This wasn't modified because of the potential impact in performance, but it means it won't fix subquestions of a wrong type if the parent question has the same type. |
|
Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=30557 |
|
Fixed in Release 4.3.20+201012 |
|
LimeSurvey: master 076d6d0e 2020-10-08 11:17 Committer: GitHub Details Diff |
Fixed issue 16708: php error in statistics view (#1616) ### Diagnosis According to the description of the issue we believe to be caused by a combination of errors: 1) When changing the type of a question from a type with subquestions to a type without subquestions (ex: from Array to List), the subquestions are not removed from the DB. The subquestions remain in the table with the old type. 2) Check Integrity processes these "orphan" subquestions making sure they match the parent question's type, without checking if it's actually correct for that type to have subquestions. So, it updates the subquestions while it should remove them. I think both actions should check the question type definition (QuestionType attributes) and, if the 'subquestions' attribute is false, remove the subquestions from the DB. ### Solution 1) Override 'update' method in Question model to delete existing subquestions if the question's type doesn't allow them. 2) Updated saveQuestionData action to avoid saving subquestions if the question's type doesn't allow them (because the subquestions are part the POST if they exist in the original question). 3) Updated common_helper's 'fixSubquestions' (used by check integrity) to do the same as mentioned in point 1. Note that 'fixSubquestions' only processes subquestions where the type is not the same as the parent question. This wasn't modified because of the potential impact in performance, but it means it won't fix subquestions of a wrong type if the parent question has the same type. |
Affected Issues 16708 |
|
mod - application/controllers/QuestionEditorController.php | Diff File | ||
mod - application/helpers/common_helper.php | Diff File | ||
mod - application/models/Question.php | Diff File |
Date Modified | Username | Field | Change |
---|---|---|---|
2020-09-30 08:44 | annighoefer | New Issue | |
2020-09-30 08:44 | annighoefer | File Added: Bildschirmfoto 2020-09-29 um 14.36.17.png | |
2020-09-30 08:44 | annighoefer | File Added: Bildschirmfoto 2020-09-29 um 15.05.58.png | |
2020-10-02 12:42 | cdorin | Assigned To | => gabrieljenik |
2020-10-02 12:42 | cdorin | Status | new => assigned |
2020-10-07 19:58 | gabrieljenik | Note Added: 60111 | |
2020-10-08 09:17 | gabrieljenik | Changeset attached | => LimeSurvey master 076d6d0e |
2020-10-08 09:17 | gabrieljenik | Note Added: 60113 | |
2020-10-08 09:17 | gabrieljenik | Resolution | open => fixed |
2020-10-12 09:28 | lime_release_bot | Note Added: 60145 | |
2020-10-12 09:28 | lime_release_bot | Status | assigned => closed |