Fix #78179: MariaDB server version incorrectly detected
authorChristoph M. Becker <cmbecker69@gmx.de>
Fri, 2 Aug 2019 14:42:49 +0000 (16:42 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Fri, 2 Aug 2019 14:42:49 +0000 (16:42 +0200)
As of MariaDB 10.0.2, the server reports a fake version number as work-
around for replication issues[1].  We apply the same "fix" as in the
MariaDB client to cater to this.

[1] <https://github.com/MariaDB/server/commit/c50ee6c23dbeb090963580754bec2f0a96ac0557#diff-5b45fa673c88c06a9651c7906364f592>

NEWS
ext/mysqlnd/mysqlnd_connection.c

diff --git a/NEWS b/NEWS
index f8508d2a307b196b0a75d38f04f1a39ae34f7a0a..31b67125f6cb093077127ef89fac7373e3c8acfc 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -20,6 +20,9 @@ PHP                                                                        NEWS
 - LiteSpeed:
   . Updated to LiteSpeed SAPI V7.5 (Fixed clean shutdown). (George Wang)
 
+- MySQLnd:
+  . Fixed bug #78179 (MariaDB server version incorrectly detected). (cmb)
+
 - Standard:
   . Fixed bug #69100 (Bus error from stream_copy_to_stream (file -> SSL stream)
     with invalid length). (Nikita)
index dc42a16b6dab2d60bc7455626a702ab8321a8ebe..42de003ef97826a218fb98f643debc8d0ceb5169 100644 (file)
@@ -1485,6 +1485,14 @@ MYSQLND_METHOD(mysqlnd_conn_data, get_server_version)(const MYSQLND_CONN_DATA *
                return 0;
        }
 
+#define MARIA_DB_VERSION_HACK_PREFIX "5.5.5-"
+
+       if (conn->server_capabilities & CLIENT_PLUGIN_AUTH
+               && !strncmp(p, MARIA_DB_VERSION_HACK_PREFIX, sizeof(MARIA_DB_VERSION_HACK_PREFIX)-1))
+       {
+               p += sizeof(MARIA_DB_VERSION_HACK_PREFIX)-1;
+       }
+
        major = ZEND_STRTOL(p, &p, 10);
        p += 1; /* consume the dot */
        minor = ZEND_STRTOL(p, &p, 10);