View Issue Details

This bug affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
17097Bug reportsInstallationpublic2021-03-22 09:12
ReporterPit Assigned Toc_schmitz  
PrioritynoneSeverityminor 
Status closedResolutionunable to reproduce 
Product Version4.4.4 
Summary17097: function cleanLanguagesFromSurvey in module common_helper.php
Description

Since the change from v3 to v4 the function mentioned above uses LEFT JOIN

$sQuery = "SELECT ls.id from {{answer_l10ns}} ls 
        JOIN {{answers}} a on ls.aid=a.aid 
        JOIN {{questions}} q on a.qid=q.qid
        WHERE sid={$iSurveyID} AND {$sqllang}";

All tables have field language and $sqllang contains field language which is now ambiguous.

v3 did not use the LEFT JOIN so it was not a problem.

Now ajax-function in save global settings returns error because of the sql error.

Proposal: use qualified field language.

Furthermore in sql installation field language is missing in table answers and questions, Shoud be there.

TagsNo tags attached.
Bug heat6
Complete LimeSurvey version number (& build)4.0
I will donate to the project if issue is resolvedNo
Browser
Database type & versionmysql 5.1
Server OS (if known)
Webserver software & version (if known)
PHP Version7.4.15

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2021-02-16 11:58

developer   ~62277

Can you explain the exact way to reproduce an issue please ?

Furthermore in sql installation field language is missing in table answers and questions, Shoud be there.

No : it's false answers and questions must not have a language field :
See https://github.com/LimeSurvey/LimeSurvey/blob/39990e8f8ed1accdc5505736967568397e3e8090/application/helpers/update/updatedb_helper.php#L2645-L2661
and https://github.com/LimeSurvey/LimeSurvey/blob/39990e8f8ed1accdc5505736967568397e3e8090/installer/create-database.php#L362-L378

Pit

Pit

2021-02-16 13:07

reporter   ~62284

Isn't it obvious? The sql query menitoned above causes an mysql error. Start e.g. phpmyadmin and enter with "lime_" as table prefix and an existing SurveyID assuming "en" as language

SELECT ls.id from lime_answer_l10ns ls JOIN lime_answers a on ls.aid=a.aid JOIN lime_questions q on a.qid=q.qid WHERE sid={$iSurveyID} AND language='en'

mysql throws an error "language is ambiguous"

You can trace the error in menu "General survey settings". Save settings and see the error 500 appearing on browser console.

PS.: In my report above "LEFT JOIN" should be replaced with "JOIN"

c_schmitz

c_schmitz

2021-02-16 17:55

administrator   ~62297

Last edited: 2021-02-16 18:09

The tables answers and questions don't have a language field anymore.
It seems like your database is corrupted/not properly updated.
I strongly recommend to restart with a fresh database or use a databse backup from 3.x and retry the update using the latest version.

Pit

Pit

2021-02-16 19:14

reporter   ~62302

I have tested before posting the bug report:

Field language removed in answers: Ok
Field language removed in questions: limesurvey not starting

The reason:
In the source of e.g. 4.4.7 there are references to language of table questions
File: /application/models/Answer.php
Function: getAnswerQuery
Line 231 $query->where("{{questions}}.sid = :surveyid AND {{questions}}.qid = {{answers}}.qid AND {{questions}}.language = {{answers}}.language AND {{questions}}.language = :lang");

Perhaps I am wrong but I have done a safe update from v3 to v4 and fields language are still present.

To be in a safe harbour: Use qualfied field like ls.language in common_helper.php.

DenisChenu

DenisChenu

2021-02-16 19:19

developer   ~62303

Field language removed in questions: limesurvey not starting

maybe you have plugins ?
Maybe send the error produced … i mean : activate debug, save error as HTML and send it here ...

It was removed from DB when update to version 400. Maybe you use a 4.0.0 release candidate ?

In the source of e.g. 4.4.7 there are references to language of table questions

@deprecated since 2018-02-05 its not working also (the language change)
https://github.com/LimeSurvey/LimeSurvey/blob/9cbf24f2c7001c61c5ba51e3bdfd8864407edcaa/application/models/Answer.php#L224

We can remove it :)

c_schmitz

c_schmitz

2021-02-16 19:21

administrator   ~62304

Last edited: 2021-02-16 19:23

getAnswerQuery is deprecated and thus not updated.

Just removing the fields will not help, as the data is converted by the upgrade functions to the answers_i18n table.
As said, I strongly recommend to do a fresh install or redo the upgrade.

c_schmitz

c_schmitz

2021-03-22 09:12

administrator   ~63514

Closing because we cannot reproduce.

Issue History

Date Modified Username Field Change
2021-02-15 22:08 Pit New Issue
2021-02-16 11:58 DenisChenu Note Added: 62277
2021-02-16 13:07 Pit Note Added: 62284
2021-02-16 17:55 c_schmitz Assigned To => c_schmitz
2021-02-16 17:55 c_schmitz Status new => feedback
2021-02-16 17:55 c_schmitz Note Added: 62297
2021-02-16 18:09 c_schmitz Note Edited: 62297
2021-02-16 19:14 Pit Note Added: 62302
2021-02-16 19:14 Pit Status feedback => assigned
2021-02-16 19:19 DenisChenu Note Added: 62303
2021-02-16 19:21 c_schmitz Note Added: 62304
2021-02-16 19:23 c_schmitz Note Edited: 62304
2021-02-17 16:01 c_schmitz Status assigned => feedback
2021-03-22 09:12 c_schmitz Status feedback => closed
2021-03-22 09:12 c_schmitz Resolution open => unable to reproduce
2021-03-22 09:12 c_schmitz Note Added: 63514