View Issue Details

This bug affects 1 person(s).
 8
IDProjectCategoryView StatusLast Update
07938Bug reportsSurvey takingpublic2013-08-04 21:54
Reporterpierro Assigned ToDenisChenu  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version2.00+ 
Fixed in Version2.00+ 
Summary07938: Can't display Array (texts) answer
Description

Hi everyone,

I just created a survey wich contains an "Array (texts)" question with a few answer. I will join a little questionnaire with the same bug.

The thing is when i want to get to this question in my survey, or even when previewing the question, I got this error "Error: There are no answer options for this question and/or they don't exist in this language.". I'm using French language.

After I doubled checked my language configuration, I started to look into the application's code and went into application/helpers/qanda_helper.php at line 5547, when the error is displayed. There is a test at line 5349 which will display this error if no lines are returned by the query. The thing is when I print this query and run it into my MySQL database I got 2 lines returned, and when I print the "$lresult->readAll()" function I got my 2 lines displayed.
So why does the count($lresult) or $lresult->count() return both 0 ?

I don't know wich files or DB dumps or even survey I could add to help you find / reproduce this.

I find a work around by turning the if into "if($lresult->readAll() != "")" but I would like to have a proper fix / solution.

TagsNo tags attached.
Attached Files
bugLimeSurvey.lss (16,293 bytes)
qanda_helper.php (294,149 bytes)
Bug heat8
Complete LimeSurvey version number (& build)130514
I will donate to the project if issue is resolvedNo
Browser
Database type & versionMysql 5.0.37
Server OS (if known)Red Hat Enterprise Linux Server release 5.4 (Tikanga)
Webserver software & version (if known)Apache 2.2.3
PHP Version5.1.6

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2013-06-30 17:35

developer   ~25692

Strange,

Because i can not reproduce. Maybe some session issue : test with click on survey logic file "dmin/expressions/sa/survey_logic_file/sid/{surveyid} before testing

Mazi

Mazi

2013-07-04 09:55

updater   ~25705

Last edited: 2013-07-04 09:59

I can not reproduce this issue on MySQL using the activated survey you attached. The single question load fine without any errors.

Are you sure that you are running MySQL and not MS SQL? Because this sounds similar to http://bugs.limesurvey.org/view.php?id=7962

pierro

pierro

2013-07-09 16:45

reporter   ~25746

Last edited: 2013-07-09 16:46

Hi,

First i thank you guys for trying to help.

I figured out something that might explained the problem : http://www.yiiframework.com/doc/api/1.1/CDbDataReader#getRowCount-detail

In the link I gave you it's said that you should not use the getRowCount function (basically the one called when doing count($lresult)) of the datareader with a select query. So I changed the qanda_helper file to get all the datas into an array with the readAll() function and then I'm counting the array size.

I will attach the file so you can take a look at it (l5349 to 5361). It's now working well for me.

Mazi

Mazi

2013-07-09 16:57

updater   ~25747

Sam, can you check if any code modification is required at the LS core?!

DenisChenu

DenisChenu

2013-07-11 19:55

developer   ~25756

Last edited: 2013-07-11 19:57

pierro : next time : better is to post a "diff" file or even better : do a pull request on github.

Denis
http://en.wikipedia.org/wiki/Comparison_of_file_comparison_tools
In linux : i use Diffuse

DenisChenu

DenisChenu

2013-07-11 21:36

developer   ~25761

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

DenisChenu

DenisChenu

2013-07-11 21:37

developer   ~25762

Please pierro : can you test with last commit if it fix.
No need better fix : we have to rewrite all qanda for 2.1

DenisChenu

DenisChenu

2013-07-11 21:39

developer   ~25763

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

DenisChenu

DenisChenu

2013-07-12 10:10

developer   ~25764

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

DenisChenu

DenisChenu

2013-07-12 10:17

developer   ~25765

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

DenisChenu

DenisChenu

2013-07-12 10:19

developer   ~25766

Please test with last qanda_helper (you can use GIT or replace your qanda_helper.php with the new one:
https://raw.github.com/LimeSurvey/LimeSurvey/c7a661aff3d139679ce147e18121c7ceff533015/application/helpers/qanda_helper.php

pierro

pierro

2013-07-15 11:38

reporter   ~25792

I replace my qanda_helper with the one you linked. It's working fine.

DenisChenu

DenisChenu

2013-07-15 12:09

developer   ~25793

Great,

Thanks for replying :)

c_schmitz

c_schmitz

2013-08-04 21:54

administrator   ~25920

2.00+ Build 130802 released

Related Changesets

LimeSurvey: master a967b589

2013-07-11 19:32:05

DenisChenu

Details Diff
Fixed issue 07938: Can't display Array (texts) answer with some SQL server
Dev: quick fix, because Question object for 2.1
Affected Issues
07938
mod - application/helpers/qanda_helper.php Diff File

LimeSurvey: 2.05 1e5e2e62

2013-07-11 19:35:23

DenisChenu

Details Diff
Fixed issue 07938: Can't display Array (texts) answer with some SQL server
Dev: quick fix, because Question object for 2.1
Affected Issues
07938
mod - application/helpers/qanda_helper.php Diff File

LimeSurvey: master c7a661af

2013-07-12 08:06:27

DenisChenu

Details Diff
Dev: Fixed issue 07938 for whole $labelans part
Dev: removed warnings , thanks to @mennodekker
Affected Issues
07938
mod - application/helpers/qanda_helper.php Diff File

LimeSurvey: 2.05 7ba4df24

2013-07-12 08:12:42

DenisChenu

Details Diff
Dev: Fixed issue 07938 for whole $labelans part
Dev: removed warnings , thanks to @mennodekker
Affected Issues
07938
mod - application/helpers/qanda_helper.php Diff File

Issue History

Date Modified Username Field Change
2013-06-19 16:23 pierro New Issue
2013-06-19 16:23 pierro File Added: bugLimeSurvey.lss
2013-06-30 17:35 DenisChenu Note Added: 25692
2013-07-04 09:55 Mazi Note Added: 25705
2013-07-04 09:59 Mazi Note Edited: 25705
2013-07-09 16:45 pierro Note Added: 25746
2013-07-09 16:46 pierro Note Edited: 25746
2013-07-09 16:47 pierro File Added: qanda_helper.php
2013-07-09 16:57 Mazi Assigned To => sammousa
2013-07-09 16:57 Mazi Status new => assigned
2013-07-09 16:57 Mazi Note Added: 25747
2013-07-11 19:55 DenisChenu Assigned To sammousa => DenisChenu
2013-07-11 19:55 DenisChenu Note Added: 25756
2013-07-11 19:57 DenisChenu Note Edited: 25756
2013-07-11 21:36 DenisChenu Changeset attached => LimeSurvey master a967b589
2013-07-11 21:36 DenisChenu Note Added: 25761
2013-07-11 21:36 DenisChenu Resolution open => fixed
2013-07-11 21:37 DenisChenu Note Added: 25762
2013-07-11 21:39 DenisChenu Changeset attached => LimeSurvey 2.05 1e5e2e62
2013-07-11 21:39 DenisChenu Note Added: 25763
2013-07-12 10:10 DenisChenu Changeset attached => LimeSurvey master c7a661af
2013-07-12 10:10 DenisChenu Note Added: 25764
2013-07-12 10:17 DenisChenu Changeset attached => LimeSurvey 2.05 7ba4df24
2013-07-12 10:17 DenisChenu Note Added: 25765
2013-07-12 10:19 DenisChenu Note Added: 25766
2013-07-12 10:19 DenisChenu Status assigned => resolved
2013-07-12 10:19 DenisChenu Fixed in Version => 2.00+
2013-07-15 11:38 pierro Note Added: 25792
2013-07-15 12:09 DenisChenu Note Added: 25793
2013-08-04 21:54 c_schmitz Note Added: 25920
2013-08-04 21:54 c_schmitz Status resolved => closed