View Issue Details

This issue affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
07768Bug reportsSurvey takingpublic2013-04-24 10:56
Reportervaldomir Assigned Toc_schmitz  
PriorityurgentSeveritypartial_block 
Status closedResolutionnot fixable 
Product Version2.00+ 
Summary07768: Error on submit survey (free text with '?' and " ' " character)
Description

If you have a "free text" question and you put some text with character "?" and "'", you receive this error:

(for example (not character "): "hola? hola? prueba d'enquesta"


Internal Server Error
CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and sid=357511' at line 1

An internal error occurred while the Web server was processing your request. Please contact the webmaster to report this problem.

Thank you.

And you receive in admin this email:


An error occurred saving a response to survey id - 357511

DATA TO BE ENTERED:
token:
357511X6173X49987: hola? hola? prueba d'enquesta

SQL CODE THAT FAILED:

ERROR MESSAGE:


If you try to put the answer manually, at
ERROR MESSAGE :

If you try to edit this answer manually (at browse responses), for example putting the text (not character "): "hola? hola? prueba d'enquesta"


Update failed:

UPDATE {{survey_357511}} SET submitdate = NULL, startlanguage = 'en', 357511X6173X49987 = 'hola? hola? prueba d\'enquesta' WHERE id=3

Steps To Reproduce

See 'description'

Additional Information

I can send you more information if you want.

Thanks,

TagsNo tags attached.
Attached Files
phpinfo.pdf (109,859 bytes)
Bug heat4
Complete LimeSurvey version number (& build)130406
I will donate to the project if issue is resolvedNo
Browser
Database type & versionMysql 5.5.24
Server OS (if known)Linux
Webserver software & version (if known)Apache 2.2.8
PHP Version5.2.4
Git branch / Pull Request URL

Users monitoring this issue

There are no users monitoring this issue.

Activities

c_schmitz

c_schmitz

2013-04-21 22:49

administrator   ~25017

Actually this works just fine here.
I also don't see why the statement
UPDATE {{survey_357511}} SET submitdate = NULL, startlanguage = 'en', 357511X6173X49987 = 'hola? hola? prueba d\'enquesta' WHERE id=3
as it is perfectly legal.

See http://dev.mysql.com/doc/refman/5.0/en/string-literals.html for more details.

This does not seem to be a LimeSurvey bug but something funny going on with your database. Maybe some weird MySQL setting? If you find out please let us know.

valdomir

valdomir

2013-04-22 09:11

reporter   ~25022

Hi,

I was doing some more tests, and I discovered that it only happens when the survey is a Token based survey.

I uploaded another .lsa file with 2 tokens created (1 one response). If you want to test, you can go to "Responses & Statistics" --> Display responses --> and edit the response (Has only one response).

Put the text: "prova? prova? d'enquesta" at "llibre" question and you will see the error

"UPDATE {{survey_963134}} SET submitdate = NULL, startlanguage = 'ca', token = 'n4u5qum5x5ym9mg', 963134X6176X50039 = 'prova? prova? d\'enquesta' WHERE id=17"

As I said you before, it only happens if the survey is a token based survey. If you remove the token table, it works pefectly.

I'm agree with you, the sql statement seems to be valid... I tried some mysql configuration changes, but I have not been successful

BUT, i did new tests:

if i put the 'UPDATE' sentence directly mysql, it returns this error:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '{survey_963134}} SET submitdate = NULL, startlanguage = 'ca', token = 'n4u' at line 1

NOW, if I remove characters '{{' and '}}' in the sql statement, it works correctly... (sentence "UPDATE survey_963134 SET submitdate = NULL, startlanguage = 'ca', token = 'n4u5qum5x5ym9mg', 963134X6176X50039 = 'prova? prova? d\'enquesta' WHERE id=17")

Thanks for your help, if you need more help... just ask me!

c_schmitz

c_schmitz

2013-04-23 11:58

administrator   ~25067

I still can't reproduce with your latest .lsa file. Can you attach your PHPInfo please? (you can see it in global settings)

The '{{' and '}}' characters in the statement are replaced automatically with the right prefix before sent to the database so that's not the reason.

valdomir

valdomir

2013-04-23 12:16

reporter   ~25072

Hi,

if you still can't to reproduce-it, as you say before it seems to be something about mysql configuration...

As you ask, I uploaded my PHPInfo.

Thanks!

c_schmitz

c_schmitz

2013-04-24 09:29

administrator   ~25103

Can you try to set magic_quotes_gpc to 'off' in your PHP configuration and see if the error is resolved?

valdomir

valdomir

2013-04-24 10:17

reporter   ~25105

Last edited: 2013-04-24 10:20

Hi,

i changed magic_quotes_gpq to off, but no success.

I set debug mode to '1' on limesuervey, and when it throws more information:

Error executing query in dbExecuteAssoc:CDbCommand failed to execute the SQL statement: SQLSTATE[HY093]: Invalid parameter number: no parameters were bound. The SQL statement executed was: UPDATE survey_888898 SET submitdate = NULL, startlanguage = 'ca', token = 'n4u5qum5x5ym9mg', 888898X6177X50040 = 'prova? d\'enquesta' WHERE id=17

it seems to be that it 'thinks' the character ? is a parameter placeholder.

if you try to execute this sql sentence at mysql, it works; it fails at execution time in php code... then, i think that is a problem at sql driver when execute a sql sentence

c_schmitz

c_schmitz

2013-04-24 10:39

administrator   ~25106

After reading up some on this it seems to be a bug in the PDO driver. The only solution would be to update to a newer version of PHP. 5.2.4 is about 6 years old, already, so an update is pretty reasonable.

valdomir

valdomir

2013-04-24 10:51

reporter   ~25107

Sorry for re-open.

as it is a problem with php version (pdo driver), i think it could be a good idea recommend a version of php at the documentation; right now it says:

PHP 5.1.6 or later with the following modules/libraries enabled

what version is the "recommended version?

c_schmitz

c_schmitz

2013-04-24 10:56

administrator   ~25108

Last edited: 2013-04-24 10:56

Will, it might be only a bug in your particular PHP version - it does not mean that it affects all previous versions too. We always recommend the latest stable version. If you have other 'old' applications installed you could try 5.2.14 first (which is the last from the 5.2 series and only 3 years old).

Issue History

Date Modified Username Field Change
2013-04-16 08:59 valdomir New Issue
2013-04-16 08:59 valdomir File Added: survey_archive_357511.lsa
2013-04-16 09:43 valdomir Issue Monitored: valdomir
2013-04-16 10:51 valdomir Issue End Monitor: valdomir
2013-04-21 22:49 c_schmitz Note Added: 25017
2013-04-21 22:49 c_schmitz Assigned To => c_schmitz
2013-04-21 22:49 c_schmitz Status new => feedback
2013-04-22 09:11 valdomir Note Added: 25022
2013-04-22 09:11 valdomir Status feedback => assigned
2013-04-22 09:12 valdomir File Added: survey_archive_357511_v2.lsa
2013-04-23 11:58 c_schmitz Note Added: 25067
2013-04-23 11:58 c_schmitz Status assigned => feedback
2013-04-23 12:15 valdomir File Added: phpinfo.pdf
2013-04-23 12:16 valdomir Note Added: 25072
2013-04-23 12:16 valdomir Status feedback => assigned
2013-04-24 09:29 c_schmitz Note Added: 25103
2013-04-24 09:29 c_schmitz Status assigned => feedback
2013-04-24 10:17 valdomir Note Added: 25105
2013-04-24 10:17 valdomir Status feedback => assigned
2013-04-24 10:20 valdomir Note Edited: 25105
2013-04-24 10:39 c_schmitz Note Added: 25106
2013-04-24 10:39 c_schmitz Status assigned => closed
2013-04-24 10:39 c_schmitz Resolution open => not fixable
2013-04-24 10:51 valdomir Note Added: 25107
2013-04-24 10:51 valdomir Status closed => feedback
2013-04-24 10:51 valdomir Resolution not fixable => reopened
2013-04-24 10:56 c_schmitz Note Added: 25108
2013-04-24 10:56 c_schmitz Status feedback => closed
2013-04-24 10:56 c_schmitz Resolution reopened => not fixable
2013-04-24 10:56 c_schmitz Note Edited: 25108