Bug Report
When visiting the Matomo system report page (wp-admin/admin.php?page=matomo-systemreport) on a WordPress site running MySQL 8.0+, the following error is logged:
Unknown system variable 'TX_ISOLATION'
The error originates from WpMatomo/Db/WordPress.php at line 440, where wpdb::get_var() executes:
The @@TX_ISOLATION system variable was deprecated in MySQL 5.7.20 and removed in MySQL 8.0. The correct variable since MySQL 5.7.20 is @@transaction_isolation.
Root Cause
The WordPress DB adapter's fetchOne() uses wpdb::get_var() internally, which does not throw on query failure — it logs the error silently and returns null, which is then converted to false:
// WpMatomo/Db/WordPress.php:440
public function fetchOne($sql, $bind = array()) {
global $wpdb;
$prepare = $this->prepareWp($sql, $bind);
$this->before_execute_query($wpdb, $sql);
$value = $wpdb->get_var($prepare); // fails silently on MySQL 8.0+, logs error
$this->after_execute_query($wpdb, $sql);
if ($value === null) {
return false; // no exception thrown
}
return $value;
}
Any caller that queries @@TX_ISOLATION and relies on an exception-based fallback to @@transaction_isolation will never reach that fallback when going through this adapter — the error is swallowed by wpdb and false is returned instead.
Environment
|
|
| Plugin |
Matomo Analytics 5.7.1 |
| WordPress |
5.9.1 Multisite |
| PHP |
8.4.18 |
| MySQL |
8.4.7 |
| Hosting |
WP Engine |
| Affected page |
wp-admin/admin.php?page=matomo-systemreport |
Bug Report
When visiting the Matomo system report page (
wp-admin/admin.php?page=matomo-systemreport) on a WordPress site running MySQL 8.0+, the following error is logged:The error originates from
WpMatomo/Db/WordPress.phpat line 440, wherewpdb::get_var()executes:SELECT @@TX_ISOLATIONThe
@@TX_ISOLATIONsystem variable was deprecated in MySQL 5.7.20 and removed in MySQL 8.0. The correct variable since MySQL 5.7.20 is@@transaction_isolation.Root Cause
The WordPress DB adapter's
fetchOne()useswpdb::get_var()internally, which does not throw on query failure — it logs the error silently and returnsnull, which is then converted tofalse:Any caller that queries
@@TX_ISOLATIONand relies on an exception-based fallback to@@transaction_isolationwill never reach that fallback when going through this adapter — the error is swallowed bywpdbandfalseis returned instead.Environment
wp-admin/admin.php?page=matomo-systemreport