View Issue Details

This bug affects 1 person(s).
 10
IDProjectCategoryView StatusLast Update
17298Bug reports_ Unknownpublic2021-07-12 11:53
Reporteradeuschlinger Assigned Toadamzammit  
PrioritynoneSeveritycrash 
Status closedResolutionfixed 
Product Version3.25.18 
Summary17298: queXML PDF Export: 500: Internal Server Error
Description500: Internal Server Error
CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]'CHAR_LENGTH' is not a recognized built-in function name.
An internal error occurred while the Web server was processing your request.
Steps To Reproduce1. Go to Survey
2. Responses
3. Click "View response details as queXML PDF"
Additional InformationThis error does not happen with every survey.
I think it is related to a certain question type.
TagsNo tags attached.
Bug heat10
Complete LimeSurvey version number (& build)3.17.9+190731
I will donate to the project if issue is resolvedNo
BrowserGoogle Chrome
Database type & versionMS SQL Server 2017
Server OS (if known)
Webserver software & version (if known)
PHP Version 7.2.19

Users monitoring this issue

User List adamzammit

Activities

ollehar

ollehar

2021-05-12 12:17

administrator   ~64368

Please update to the latest version and check if the bug can still be reproduced. Thank you.
adamzammit

adamzammit

2021-05-13 01:29

developer   ~64401

I don't have an MSSQL server but my guess is this bug will still occur in the latest version due to this code:

helpers/export_helper.php:

1758 case "R": //RANKING STYLE
1759 quexml_create_subQuestions($question, $qid, $sgq, $iResponseID, $fieldmap, true);
1760
1761 $QROW = Yii::app()->db->createCommand()
1762 ->select('MAX(CHAR_LENGTH(code)) as sc')
1763 ->from("{{answers}}")
1764 ->where(" qid=:qid AND language=:language", array(':qid'=>$qid, ':language'=>$quexmllang))
1765 ->queryRow();
1766
1767 $response->appendChild(QueXMLCreateFree("integer", $QROW['sc'], ""));
1768 $question->appendChild($response);
1769 break;


I'll work on an update that checks for MSSQL and rewrites the query
adamzammit

adamzammit

2021-05-13 03:32

developer   ~64402

@adeuschlinger

This error will show up on MSSQL when a survey has a ranking style question.

Can you please replace application/helpers/export_helper.php with the attached file and try again and see if it fixes the issue - if so I'll apply the patch to the next LimeSurvey release.
export_helper.php (119,966 bytes)
adeuschlinger

adeuschlinger

2021-05-30 23:05

reporter   ~64660

Thank you @adamzammit

I replaced the php file.
And the export is working without any error now.
ollehar

ollehar

2021-05-31 09:52

administrator   ~64663

Great, Adam. Do we have a PR for this?
adamzammit

adamzammit

2021-06-01 01:16

developer   ~64681

Created here: https://github.com/LimeSurvey/LimeSurvey/pull/1902
Will probably need to apply to master too

Adam
adamzammit

adamzammit

2021-06-01 10:36

developer   ~64684

Fix committed to 3.x-LTS branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=31929
ollehar

ollehar

2021-06-01 10:39

administrator   ~64685

Hi,

Yes, a separate PR has to be created for master, since the query is a little bit different. Couldn't trivially cherry-pick it, and someone needs to test it first.
adamzammit

adamzammit

2021-06-02 02:42

developer   ~64702

@ollehar - Created here for master: https://github.com/LimeSurvey/LimeSurvey/pull/1905

Looks very similar to me but happy to wait for someone to test before merging.
adamzammit

adamzammit

2021-06-02 12:30

developer   ~64709

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

c_schmitz

2021-07-12 11:53

administrator   ~65312

Release done.

Related Changesets

LimeSurvey: 3.x-LTS 3941ba97

2021-06-01 10:36:53

adamzammit


Committer: GitHub Details Diff
Fixed issue 17298: queXML PDF Export: 500: Internal Server Error (#1902) Affected Issues
17298
mod - application/helpers/export_helper.php Diff File

LimeSurvey: master 8646a784

2021-06-02 12:30:37

adamzammit


Committer: GitHub Details Diff
Fixed issue 17298: queXML PDF Export: 500: Internal Server Error (#1905) Affected Issues
17298
mod - application/helpers/export_helper.php Diff File

Issue History

Date Modified Username Field Change
2021-05-12 11:18 adeuschlinger New Issue
2021-05-12 12:17 ollehar Severity minor => crash
2021-05-12 12:17 ollehar Assigned To => ollehar
2021-05-12 12:17 ollehar Status new => feedback
2021-05-12 12:17 ollehar Note Added: 64368
2021-05-13 01:24 adamzammit Issue Monitored: adamzammit
2021-05-13 01:29 adamzammit Note Added: 64401
2021-05-13 03:32 adamzammit Note Added: 64402
2021-05-13 03:32 adamzammit File Added: export_helper.php
2021-05-18 13:34 ollehar Product Version => 3.25.18
2021-05-30 23:05 adeuschlinger Note Added: 64660
2021-05-30 23:05 adeuschlinger Status feedback => assigned
2021-05-31 09:52 ollehar Note Added: 64663
2021-06-01 01:16 adamzammit Note Added: 64681
2021-06-01 10:36 adamzammit Changeset attached => LimeSurvey 3.x-LTS 3941ba97
2021-06-01 10:36 adamzammit Note Added: 64684
2021-06-01 10:36 adamzammit Assigned To ollehar => adamzammit
2021-06-01 10:36 adamzammit Resolution open => fixed
2021-06-01 10:39 ollehar Note Added: 64685
2021-06-02 02:42 adamzammit Note Added: 64702
2021-06-02 12:30 adamzammit Changeset attached => LimeSurvey master 8646a784
2021-06-02 12:30 adamzammit Note Added: 64709
2021-06-09 13:46 ollehar Status assigned => resolved
2021-07-12 11:53 c_schmitz Note Added: 65312
2021-07-12 11:53 c_schmitz Status resolved => closed
2021-08-02 17:49 guest Bug heat 8 => 10