View Issue Details

This bug affects 1 person(s).
 2
IDProjectCategoryView StatusLast Update
09283Bug reportsSurvey takingpublic2014-11-26 10:29
Reporteranthony_b Assigned Toc_schmitz  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version2.05+ 
Fixed in Version2.05+ 
Summary09283: Short text field not limited to 255 characters when using PostgreSQL
Description

When using a postgresql database, short text fields are created as 'character varying(255)', even when no limit is set on the actual question.

Survey participants are able to submit a response that exceeds this limit without any warning. An error is output to the participant, such as:

Error executing query in dbExecuteAssoc:CDbCommand failed to execute the SQL statement: SQLSTATE[22001]: String data, right truncated: 7 ERROR: value too long for type character varying(255). The SQL statement executed was: UPDATE survey_864954 SET "lastpage"=1, "864954X3X3"='LONG_INPUT' WHERE ID=2

(I truncated the actual response to 'LONG_INPUT').

and the survey administrator receives an email with the subject 'Error saving results'. There is no error actually included, the text at the end just shows:

SQL CODE THAT FAILED:

ERROR MESSAGE:

Steps To Reproduce

Create a survey and add a question of type 'short free text'.
Activate survey
Execute survey, and enter a response in excess of 255 characters
Click next

Additional Information

I believe the issue exists in:

application/helpers/admin/activate_helper.php

on line 293, where the type is set to 'string' for non-MySQL databases. Within the Yii Framework, it appears that this type is cast to varchar(255). Eg, for PostgreSQL, see:

framework/db/schema/pgsql/CPgsqlSchema.php (Line 28)

It appears the issue would affect SQL server as well. Although I have not tested it, it appears that MySQL would behave correctly.

TagsNo tags attached.
Attached Files
Bug heat2
Complete LimeSurvey version number (& build)141003
I will donate to the project if issue is resolvedNo
Browser
Database type & versionPostgreSQL 9.1.3
Server OS (if known)Debian Linux 7 (Wheezy)
Webserver software & version (if known)Apache 2.2.22-13
PHP Version5.4.4-14

Users monitoring this issue

There are no users monitoring this issue.

Activities

c_schmitz

c_schmitz

2014-11-24 19:52

administrator   ~31089

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

c_schmitz

c_schmitz

2014-11-24 19:53

administrator   ~31090

The short text field indeed can only collect 255 characters on Postgres and MSSQL - that is the intended behaviour. Fixed it so that not more than 255 characters can entered on these DB systems.

c_schmitz

c_schmitz

2014-11-26 10:29

administrator   ~31095

Version 2.05 Build 141126 released

Related Changesets

LimeSurvey: master cacfd7ab

2014-11-24 18:52:13

c_schmitz

Details Diff
Fixed issue 09283: More than 255 characters can be entered into a short text question on Postgres and MSSQL which leads to an error Affected Issues
09283
mod - application/helpers/qanda_helper.php Diff File

Issue History

Date Modified Username Field Change
2014-10-08 09:29 anthony_b New Issue
2014-10-08 09:29 anthony_b File Added: limesurvey_survey_864954.lss
2014-11-24 19:40 c_schmitz Assigned To => c_schmitz
2014-11-24 19:40 c_schmitz Status new => assigned
2014-11-24 19:52 c_schmitz Changeset attached => LimeSurvey master cacfd7ab
2014-11-24 19:52 c_schmitz Note Added: 31089
2014-11-24 19:52 c_schmitz Resolution open => fixed
2014-11-24 19:53 c_schmitz Note Added: 31090
2014-11-24 19:53 c_schmitz Status assigned => resolved
2014-11-24 19:53 c_schmitz Fixed in Version => 2.05+
2014-11-24 20:00 c_schmitz Summary Short text field limited to 255 characters when using PostgreSQL => Short text field not limited to 255 characters when using PostgreSQL
2014-11-26 10:29 c_schmitz Note Added: 31095
2014-11-26 10:29 c_schmitz Status resolved => closed