awesomemotive / wp-mail-logging

:envelope: Logs each email sent by WordPress.
49 stars 24 forks source link

Fix MySQL 8 syntax error #161

Closed donmhico closed 1 year ago

donmhico commented 1 year ago

Description

This PR fixes the syntax error when using MySQL 8 with sql-mode = ANSI_QUOTES. This is the error:

WordPress database error 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 '"wp_wpml_mails"' at line 1 for query SHOW TABLES LIKE "wp_wpml_mails" made by require_once('wp-admin/admin.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), include_once('/plugins/wp-mail-logging/wp-mail-logging.php'), No3x\WPML\WPML_Init->init, No3x\WPML\WPML_InstallIndicator->isInstalled

Testing procedure

  1. Make sure your WP site is running on MySQL 8 with sql-mode = ANSI_QUOTES. You can do this by editing your MySQL's .cnf.
[mysqld]

sql-mode = ANSI_QUOTES
  1. Enable debugging in your WordPress.
  2. Activate the WP Mail Logging plugin.
  3. You shouldn't see the error in debug.log.