From bfa8d95d6f016efdedb943c1fe977d89de13406c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Mon, 10 Jan 2022 10:47:49 +0100 Subject: [PATCH] Strip MariaDB replication version hack in MySQLDatabase::getVersion() Resolves #4626 --- .../files/lib/system/database/MySQLDatabase.class.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/system/database/MySQLDatabase.class.php b/wcfsetup/install/files/lib/system/database/MySQLDatabase.class.php index 8d986ff38d..9e6b3dcaae 100644 --- a/wcfsetup/install/files/lib/system/database/MySQLDatabase.class.php +++ b/wcfsetup/install/files/lib/system/database/MySQLDatabase.class.php @@ -94,7 +94,15 @@ class MySQLDatabase extends Database $statement = $this->prepareStatement('SELECT VERSION()'); $statement->execute(); - return $statement->fetchSingleColumn(); + $version = $statement->fetchSingleColumn(); + + // Strip MariaDB replication version hack. + // see https://stackoverflow.com/a/56607492/782822 + if (\stripos($version, 'MariaDB') !== false) { + $version = \preg_replace('/^5\\.5\\.5-/', '', $version); + } + + return $version; } catch (\PDOException $e) { } -- 2.20.1