An exception occurred while executing REPLACE INTO campaign_lead_event_failed_log

Your software
My Mautic version is: 2.16.2
My PHP version is: 7.3.18

Your problem
My problem is:
Running email fetches with command: console mautic:email:fetch in Terminal shows::
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 ':dateAdded as date_added, :message as reason from campaign_lead_event_log
WHERE ’ at line 2

That only happened once, but similar errors started to appear in the Mautic Logs):

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 ':dateAdded as date_added, :message as reason from campaign_lead_event_log
WHERE ’ at line 2

These errors are showing in the log:
[2020-05-24 12:32:57] mautic.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\SyntaxErrorException: “An exception occurred while executing ‘REPLACE INTO campaign_lead_event_failed_log( log_id, date_added, reason) SELECT id, :dateAdded as date_added, :message as reason from campaign_lead_event_log WHERE is_scheduled = 1 AND lead_id = :contactId AND campaign_id = :campaignId AND rotation = :rotation’: 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 ':dateAdded as date_added, :message as reason from campaign_lead_event_log WHERE ’ at line 2” at /home/carameltrail/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 90 {“exception”:"[object] (Doctrine\DBAL\Exception\SyntaxErrorException(code: 0): An exception occurred while executing ‘REPLACE INTO campaign_lead_event_failed_log( log_id, date_added, reason)\nSELECT id, :dateAdded as date_added, :message as reason from campaign_lead_event_log\nWHERE is_scheduled = 1 AND lead_id = :contactId AND campaign_id = :campaignId AND rotation = :rotation’:\n\nYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':dateAdded as date_added, :message as reason from campaign_lead_event_log\nWHERE ’ at line 2 at /home/carameltrail/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:90, Doctrine\DBAL\Driver\Mysqli\MysqliException(code: 0): 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 ':dateAdded as date_added, :message as reason from campaign_lead_event_log\nWHERE ’ at line 2 at /home/carameltrail/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php:101)"}

[2020-05-24 14:00:02] mautic.ERROR: CAMPAIGN: An exception occurred while executing ‘REPLACE INTO campaign_lead_event_failed_log( log_id, date_added, reason) SELECT id, :dateAdded as date_added, :message as reason from campaign_lead_event_log WHERE is_scheduled = 1 AND lead_id = :contactId AND campaign_id = :campaignId AND rotation = :rotation’: 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 ':dateAdded as date_added, :message as reason from campaign_lead_event_log WHERE ’ at line 2

Steps I have tried to fix the problem:
I saw using driver mysqli can cause something related there can be still a bug in the code.

Went to EasyApache4 and enabled php73-php-pdo (pdo_mysql)

Changed value of property ‘db_driver’ from ‘mysqli’ to ‘db_driver’ => ‘pdo_mysql’, in app/config/local.php

Cleared the cache with command rm -rf app/cache/prod/* from the Mautic root directory.

Looks like it is working… no more errors logged (An exception occurred while executing 'REPLACE INTO campaign_lead_event_failed_log).

It looks like a regression of this bug:

1 Like