View Issue Details

This bug affects 1 person(s).
 0
IDProjectCategoryView StatusLast Update
20097Bug reportsSurvey takingpublic2025-05-08 14:33
Reportergabrieljenik Assigned Togabrieljenik  
PrioritynoneSeveritypartial_block 
Status assignedResolutionopen 
Product Version6.4.x 
Summary20097: SQL Error when saving failed email notifications
Description

When:

  • enabling admin notifications
  • and an error happens when sending notification,
  • a record is attempted to be saved to lime_failed_emails

Fails with this error:

CDbException
CDbCommand failed to execute the SQL statement: SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect string value: '\xF2\x00H[\x185...' for column `sample_ls5`.`lime_failed_emails`.`error_message` at row 1. The SQL statement executed was: INSERT INTO `lime_failed_emails` (`language`, `status`, `recipient`, `surveyid`, `responseid`, `email_type`, `error_message`, `created`, `updated`, `resend_vars`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6, NOW(), :yp7, :yp8)
/home/sample/public_html/vendor/yiisoft/yii/framework/db/CDbCommand.php(358)
346         {
347             if($this->_connection->enableProfiling)
348                 Yii::endProfile('system.db.CDbCommand.execute('.$this->getText().$par.')','system.db.CDbCommand.execute');
349 
350             $errorInfo=$e instanceof PDOException ? $e->errorInfo : null;
351             $message=$e->getMessage();
352             Yii::log(Yii::t('yii','CDbCommand::execute() failed: {error}. The SQL statement executed was: {sql}.',
353                 array('{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand');
354 
355             if(YII_DEBUG)
356                 $message.='. The SQL statement executed was: '.$this->getText().$par;
357 
358             throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
359                 array('{error}'=>$message)),(int)$e->getCode(),$errorInfo);
360         }
361     }
362 
363     /**
364      * Executes the SQL statement and returns query result.
365      * This method is for executing an SQL query that returns result set.
366      * @param array $params input parameters (name=>value) for the SQL execution. This is an alternative
367      * to {@link bindParam} and {@link bindValue}. If you have multiple input parameters, passing
368      * them in this way can improve the performance. Note that if you pass parameters in this way,
369      * you cannot bind parameters or values using {@link bindParam} or {@link bindValue}, and vice versa.
370      * Please also note that all values are treated as strings in this case, if you need them to be handled as
Stack Trace
#0
+  /home/sample/public_html/vendor/yiisoft/yii/framework/db/ar/CActiveRecord.php(1083): CDbCommand->execute()
#1
+  /home/sample/public_html/vendor/yiisoft/yii/framework/db/ar/CActiveRecord.php(811): CActiveRecord->insert(null)
#2
–  /home/sample/public_html/application/helpers/frontend_helper.php(699): CActiveRecord->save(false)
694     $failedEmailModel->created = date('Y-m-d H:i:s');
695     $failedEmailModel->status = 'SEND FAILED';
696     $failedEmailModel->updated = date('Y-m-d H:i:s');
697     $failedEmailModel->resend_vars = $resendVars;
698 
699     return $failedEmailModel->save(false);
700 }
701 
702 function failedEmailSuccess($id)
703 {
704     $model = new FailedEmail();
#3
–  /home/sample/public_html/application/helpers/frontend_helper.php(550): saveFailedEmail(null, "sophie@logicaloutcomes.net", 616768, 1001, ...)
545                 $mailer->setTo($notificationRecipient);
546                 $mailerSuccess = $mailer->SendMessage();
547             }
548             if (!$mailerSuccess) {
549                 $failedEmailCount++;
550                 saveFailedEmail($failedNotificationId, $notificationRecipient, $surveyid, $responseId, 'admin_notification', $emailLanguage, $mailer);
551                 if (empty($emails) && $debug > 0 && Permission::model()->hasSurveyPermission($surveyid, 'surveysettings', 'update')) {
552                     /* Find a better way to show email error … */
553                     echo CHtml::tag(
554                         "div",
555                         ['class' => 'alert alert-danger'],
#4
–  /home/sample/public_html/application/helpers/SurveyRuntimeHelper.php(1271): sendSubmitNotifications(616768)
1266             if ($surveyActive && $oSurvey->getHasTokensTable()) {
1267                 submittokens();
1268             }
1269             //Send notifications
1270             if ($surveyActive) {
1271                 sendSubmitNotifications($this->iSurveyid);
1272             }
1273             // Link to Print Answer Preview  **********
1274             $this->aSurveyInfo['aCompleted']['aPrintAnswers']['show'] = false;
1275             if ($this->aSurveyInfo['printanswers'] == 'Y') {
1276                 $this->aSurveyInfo['aCompleted']['aPrintAnswers']['show']  = true;
#5
+  /home/sample/public_html/application/helpers/SurveyRuntimeHelper.php(219): SurveyRuntimeHelper->moveSubmitIfNeeded()
#6
+  /home/sample/public_html/application/controllers/survey/SurveyIndex.php(643): SurveyRuntimeHelper->run(616768, array("surveyid" => 616768, "thissurvey" => array("sid" => 616768, "owner_id" => 5, "gsid" => 1, "admin" => "Administrator", ...), "thisstep" => 6, "tokensexist" => 0, ...))
#7
+  /home/sample/public_html/application/controllers/survey/SurveyIndex.php(22): SurveyIndex->action()
#8
+  /home/sample/public_html/vendor/yiisoft/yii/framework/web/actions/CAction.php(76): SurveyIndex->run()
#9
+  /home/sample/public_html/vendor/yiisoft/yii/framework/web/CController.php(308): CAction->runWithParams(array("sid" => "616768"))
#10
+  /home/sample/public_html/vendor/yiisoft/yii/framework/web/CController.php(286): CController->runAction(SurveyIndex)
#11
+  /home/sample/public_html/vendor/yiisoft/yii/framework/web/CController.php(265): CController->runActionWithFilters(SurveyIndex, array())
#12
+  /home/sample/public_html/vendor/yiisoft/yii/framework/web/CWebApplication.php(282): CController->run("index")
#13
+  /home/sample/public_html/vendor/yiisoft/yii/framework/web/CWebApplication.php(141): CWebApplication->runController("survey/index/sid/616768")
#14
+  /home/sample/public_html/vendor/yiisoft/yii/framework/base/CApplication.php(185): CWebApplication->processRequest()
#15
+  /home/sample/public_html/index.php(161): CApplication->run()
Steps To Reproduce

Hard to reproduce without tampering the code or credentials, as hard to trigger an email sending error

Additional Information

ChatGPT said it could be an issue with a character not matching the expected encoding.

TagsNo tags attached.
Bug heat0
Complete LimeSurvey version number (& build)6.4
I will donate to the project if issue is resolvedNo
Browser
Database type & versionMysql
Server OS (if known)
Webserver software & version (if known)
PHP Version8

Users monitoring this issue

There are no users monitoring this issue.

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2025-05-08 14:13 gabrieljenik New Issue
2025-05-08 14:15 gabrieljenik Description Updated
2025-05-08 14:15 gabrieljenik Additional Information Updated
2025-05-08 14:33 tibor.pacalat Assigned To => gabrieljenik
2025-05-08 14:33 tibor.pacalat Status new => assigned