Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowing spam emails throwing erros #1677

Open
Rednas140 opened this issue Dec 10, 2024 · 0 comments
Open

Allowing spam emails throwing erros #1677

Rednas140 opened this issue Dec 10, 2024 · 0 comments
Labels
issue Something isn't working correctly

Comments

@Rednas140
Copy link

What happened?

One of the forms on our client's website occasionally marks legitimate emails as spam. This behaviour is expected from time to time, as false positives can happen with spam filters. This shouldn't be an issue due to the functionality of being able to approve spam messages using the "Allow" button withing the spam entry. However both the client and ourselves have encountered a problem when attempting to use this functionality. Specifically, when the "Allow" button is pressed to restore these emails, an Integrity Constraint Violation error occurs (See stack trace) due to a duplicate entry and these false positives don't get sent to the normal form submissions.

This prevents our clients from being able to properly address these emails. Is there a fix currently available, or is this functionality broken?

Errors and Stack Trace (if available)

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '36337-2' for key 'dnp_idx_lkhmbyrmwfgdrimdkhizlaweiqdowddotuxw' in /projects/melanchth_05/vendor/yiisoft/yii2/db/Command.php:1320
Stack trace:
#0 /projects/melanchth_05/vendor/yiisoft/yii2/db/Command.php(1320): PDOStatement->execute()
#1 /projects/melanchth_05/vendor/yiisoft/yii2/db/Command.php(1120): yii\db\Command->internalExecute()
#2 /projects/melanchth_05/vendor/yiisoft/yii2/db/Schema.php(431): yii\db\Command->execute()
#3 /projects/melanchth_05/vendor/yiisoft/yii2/db/ActiveRecord.php(604): yii\db\Schema->insert()
#4 /projects/melanchth_05/vendor/yiisoft/yii2/db/ActiveRecord.php(570): yii\db\ActiveRecord->insertInternal()
#5 /projects/melanchth_05/vendor/yiisoft/yii2/db/BaseActiveRecord.php(688): yii\db\ActiveRecord->insert()
#6 /projects/melanchth_05/vendor/craftcms/cms/src/services/Elements.php(3757): yii\db\BaseActiveRecord->save()
#7 /projects/melanchth_05/vendor/craftcms/cms/src/services/Elements.php(1217): craft\services\Elements->craft\services\{closure}()
#8 /projects/melanchth_05/vendor/craftcms/cms/src/services/Elements.php(3578): craft\services\Elements->ensureBulkOp()
#9 /projects/melanchth_05/vendor/craftcms/cms/src/services/Elements.php(4120): craft\services\Elements->_saveElementInternal()
#10 /projects/melanchth_05/vendor/craftcms/cms/src/services/Elements.php(3797): craft\services\Elements->_propagateElement()
#11 /projects/melanchth_05/vendor/craftcms/cms/src/services/Elements.php(1217): craft\services\Elements->craft\services\{closure}()
#12 /projects/melanchth_05/vendor/craftcms/cms/src/services/Elements.php(3578): craft\services\Elements->ensureBulkOp()
#13 /projects/melanchth_05/vendor/craftcms/cms/src/services/Elements.php(1303): craft\services\Elements->_saveElementInternal()
#14 /projects/melanchth_05/vendor/solspace/craft-freeform/packages/plugin/src/Services/SpamSubmissionsService.php(39): craft\services\Elements->saveElement()
#15 /projects/melanchth_05/vendor/solspace/craft-freeform/packages/plugin/src/controllers/SpamSubmissionsController.php(68): Solspace\Freeform\Services\SpamSubmissionsService->allowSpamSubmission()
#16 [internal function]: Solspace\Freeform\controllers\SpamSubmissionsController->actionAllow()
#17 /projects/melanchth_05/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
#18 /projects/melanchth_05/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams()
#19 /projects/melanchth_05/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction()
#20 /projects/melanchth_05/vendor/craftcms/cms/src/web/Application.php(350): yii\base\Module->runAction()
#21 /projects/melanchth_05/vendor/craftcms/cms/src/web/Application.php(649): craft\web\Application->runAction()
#22 /projects/melanchth_05/vendor/craftcms/cms/src/web/Application.php(312): craft\web\Application->_processActionRequest()
#23 /projects/melanchth_05/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest()
#24 /projects/melanchth_05/public_html/index.php(12): yii\base\Application->run()
#25 {main}

Next yii\db\IntegrityException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '36337-2' for key 'dnp_idx_lkhmbyrmwfgdrimdkhizlaweiqdowddotuxw'
The SQL being executed was: INSERT INTO `dnp_elements_sites` (`elementId`, `siteId`, `title`, `slug`, `uri`, `enabled`, `content`, `dateCreated`, `dateUpdated`, `uid`) VALUES (36337, 2, '2024-12-10 13:37:59', NULL, NULL, 1, NULL, '2024-12-10 14:32:33', '2024-12-10 14:32:33', 'ff7d4c0f-3f03-4c84-b50d-b87eed0da1c0') in /projects/melanchth_05/vendor/yiisoft/yii2/db/Schema.php:676
Stack trace:
#0 /projects/melanchth_05/vendor/yiisoft/yii2/db/Command.php(1325): yii\db\Schema->convertException()
#1 /projects/melanchth_05/vendor/yiisoft/yii2/db/Command.php(1120): yii\db\Command->internalExecute()
#2 /projects/melanchth_05/vendor/yiisoft/yii2/db/Schema.php(431): yii\db\Command->execute()
#3 /projects/melanchth_05/vendor/yiisoft/yii2/db/ActiveRecord.php(604): yii\db\Schema->insert()
#4 /projects/melanchth_05/vendor/yiisoft/yii2/db/ActiveRecord.php(570): yii\db\ActiveRecord->insertInternal()
#5 /projects/melanchth_05/vendor/yiisoft/yii2/db/BaseActiveRecord.php(688): yii\db\ActiveRecord->insert()
#6 /projects/melanchth_05/vendor/craftcms/cms/src/services/Elements.php(3757): yii\db\BaseActiveRecord->save()
#7 /projects/melanchth_05/vendor/craftcms/cms/src/services/Elements.php(1217): craft\services\Elements->craft\services\{closure}()
#8 /projects/melanchth_05/vendor/craftcms/cms/src/services/Elements.php(3578): craft\services\Elements->ensureBulkOp()
#9 /projects/melanchth_05/vendor/craftcms/cms/src/services/Elements.php(4120): craft\services\Elements->_saveElementInternal()
#10 /projects/melanchth_05/vendor/craftcms/cms/src/services/Elements.php(3797): craft\services\Elements->_propagateElement()
#11 /projects/melanchth_05/vendor/craftcms/cms/src/services/Elements.php(1217): craft\services\Elements->craft\services\{closure}()
#12 /projects/melanchth_05/vendor/craftcms/cms/src/services/Elements.php(3578): craft\services\Elements->ensureBulkOp()
#13 /projects/melanchth_05/vendor/craftcms/cms/src/services/Elements.php(1303): craft\services\Elements->_saveElementInternal()
#14 /projects/melanchth_05/vendor/solspace/craft-freeform/packages/plugin/src/Services/SpamSubmissionsService.php(39): craft\services\Elements->saveElement()
#15 /projects/melanchth_05/vendor/solspace/craft-freeform/packages/plugin/src/controllers/SpamSubmissionsController.php(68): Solspace\Freeform\Services\SpamSubmissionsService->allowSpamSubmission()
#16 [internal function]: Solspace\Freeform\controllers\SpamSubmissionsController->actionAllow()
#17 /projects/melanchth_05/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
#18 /projects/melanchth_05/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams()
#19 /projects/melanchth_05/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction()
#20 /projects/melanchth_05/vendor/craftcms/cms/src/web/Application.php(350): yii\base\Module->runAction()
#21 /projects/melanchth_05/vendor/craftcms/cms/src/web/Application.php(649): craft\web\Application->runAction()
#22 /projects/melanchth_05/vendor/craftcms/cms/src/web/Application.php(312): craft\web\Application->_processActionRequest()
#23 /projects/melanchth_05/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest()
#24 /projects/melanchth_05/public_html/index.php(12): yii\base\Application->run()
#25 {main}
Additional Information:
Array
(
    [0] => 23000
    [1] => 1062
    [2] => Duplicate entry '36337-2' for key 'dnp_idx_lkhmbyrmwfgdrimdkhizlaweiqdowddotuxw'
)

How can we reproduce this?

  1. Send a form entry using a blocked email or some other method to immediatly identify as spam
  2. Go to spam entries
  3. Open the spam entry
  4. Press the "Allow" button on the spam entry

Freeform Edition

Pro

Freeform Version

5.8.1

Craft Version

5.5.5

When did this issue start?

Unsure

Previous Freeform Version

No response

@Rednas140 Rednas140 added the issue Something isn't working correctly label Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue Something isn't working correctly
Development

No branches or pull requests

1 participant