View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
06117Bug reportsSurvey participants (Tokens)public2012-05-28 15:12
ReporterFred Assigned ToDenisChenu  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version2.00RC1 
Fixed in Version2.00RC2 
Summary06117: Crash when generating tokens for items token list that have not been issued one
Description

When you add participants to a survey or import a CSV, the token value is initially empty and you need to either manually edit it or use the generate tokens function.

Generate tokens is causing a crash in 2.0RC1

I think this was happening previously and was fixed?
I am using the latest version synced from github this morning.

An alternative solution would be to have the token value automatically created when the participant is added to the survey.

Steps To Reproduce
  1. Add a participant to a survey. (Or import a CSV to tokens)
  2. Press the generate tokens button
  3. Select yes
Additional Information

CDbException

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 ''{{tokens_61265}}' SET token= 'ppqscsy9wbi56h9' WHERE tid='3'' at line 1. The SQL statement executed was: UPDATE :tablename SET token= :newtoken WHERE tid=:tid

/Users/fred/Dropbox/MAMP/htdocs/LimeSurvey/framework/db/CDbCommand.php(354)

342 return $n;
343 }
344 catch(Exception $e)
345 {
346 if($this->_connection->enableProfiling)
347 Yii::endProfile('system.db.CDbCommand.execute('.$this->getText().')','system.db.CDbCommand.execute');
348 $errorInfo = $e instanceof PDOException ? $e->errorInfo : null;
349 $message = $e->getMessage();
350 Yii::log(Yii::t('yii','CDbCommand::execute() failed: {error}. The SQL statement executed was: {sql}.',
351 array('{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand');
352 if(YII_DEBUG)
353 $message .= '. The SQL statement executed was: '.$this->getText().$par;
354 throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
355 array('{error}'=>$message)),(int)$e->getCode(),$errorInfo);
356 }
357 }
358
359 /*
360
Executes the SQL statement and returns query result.
361 This method is for executing an SQL query that returns result set.
362
@param array $params input parameters (name=>value) for the SQL execution. This is an alternative
363 to {@link bindParam} and {@link bindValue}. If you have multiple input parameters, passing
364
them in this way can improve the performance. Note that if you pass parameters in this way,
365 you cannot bind parameters or values using {@link bindParam} or {@link bindValue}, and vice versa.
366
binding methods and the input parameters this way can improve the performance.
Stack Trace
#0
– /Users/fred/Dropbox/MAMP/htdocs/LimeSurvey/application/models/Tokens_dynamic.php(141): CDbCommand->execute()
136 {
137 return Yii::app()->db->createCommand('UPDATE :tablename SET token= :newtoken WHERE tid=:tid')
138 ->bindParam(":newtoken", $newtoken, PDO::PARAM_STR)
139 ->bindParam(":tid", $tid, PDO::PARAM_INT)
140 ->bindParam(":tablename", $this->tableName(), PDO::PARAMSTR)
141 ->execute();
142 }
143 function selectEmptyTokens($iSurveyID)
144 {
145 return Yii::app()->db->createCommand("SELECT tid FROM {{tokens
{$iSurveyID}}} WHERE token IS NULL OR token=''")->queryAll();
146 }
#1
– /Users/fred/Dropbox/MAMP/htdocs/LimeSurvey/application/models/Tokens_dynamic.php(180): Tokens_dynamic->updateToken("3", "ppqscsy9wbi56h9")
175 if (!in_array($newtoken, $existingtokens)) {
176 $existingtokens[] = $newtoken;
177 $bIsValidToken = true;
178 }
179 }
180 $itresult = $this->updateToken($tkrow['tid'], $newtoken);
181 $newtokencount++;
182 }
183 return $newtokencount;
184
185 }

TagsNo tags attached.
Bug heat4
Complete LimeSurvey version number (& build)000000
I will donate to the project if issue is resolvedNo
BrowserChrome, Safari
Database type & versionMySQL 5.5.9
Server OS (if known)Mac OS Lion
Webserver software & version (if known)Apache 2.2.17
PHP Version5.3.6

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2012-05-19 01:01

developer   ~18855

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

c_schmitz

c_schmitz

2012-05-28 15:12

administrator   ~18948

Version 2.00RC2 released.

Related Changesets

LimeSurvey: Yii 1b80aec5

2012-05-18 16:00:02

DenisChenu

Details Diff
Fixed issue 06117 : Crash when generating tokens for items token list that have not been issued one
Dev: no tablename in PDO param http://php.net/manual/book.pdo.php#69304
Affected Issues
06117
mod - application/models/Tokens_dynamic.php Diff File

Issue History

Date Modified Username Field Change
2012-05-18 18:32 Fred New Issue
2012-05-19 01:01 DenisChenu Changeset attached => LimeSurvey Yii 1b80aec5
2012-05-19 01:01 DenisChenu Note Added: 18855
2012-05-19 01:01 DenisChenu Assigned To => DenisChenu
2012-05-19 01:01 DenisChenu Resolution open => fixed
2012-05-19 01:01 DenisChenu Status new => resolved
2012-05-19 01:01 DenisChenu Fixed in Version => 2.00RC2
2012-05-28 15:12 c_schmitz Note Added: 18948
2012-05-28 15:12 c_schmitz Status resolved => closed
2016-12-08 10:39 c_schmitz Category Tokens => Survey participants (Tokens)