Strip MariaDB replication version hack in MySQLDatabase::getVersion()
authorTim Düsterhus <duesterhus@woltlab.com>
Mon, 10 Jan 2022 09:47:49 +0000 (10:47 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Mon, 10 Jan 2022 09:47:49 +0000 (10:47 +0100)
Resolves #4626

wcfsetup/install/files/lib/system/database/MySQLDatabase.class.php

index 8d986ff38d265d655baef530bb976ce69ce77d9c..9e6b3dcaae4558fb5ad765c23f6a315330bdace1 100644 (file)
@@ -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) {
         }