From 4bd31646729cbde1304596a46989e7a734eeec4b Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Wed, 24 Jul 2019 15:13:25 +0200 Subject: [PATCH] Fix #78179: MariaDB server version incorrectly detected 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] --- ext/mysqlnd/mysqlnd_connection.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ext/mysqlnd/mysqlnd_connection.c b/ext/mysqlnd/mysqlnd_connection.c index dc42a16b6dab2..42de003ef9782 100644 --- a/ext/mysqlnd/mysqlnd_connection.c +++ b/ext/mysqlnd/mysqlnd_connection.c @@ -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);