Skip to content

Commit f9f4a68

Browse files
committed
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] <MariaDB/server@c50ee6c#diff-5b45fa673c88c06a9651c7906364f592>
1 parent 85e8ccd commit f9f4a68

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ PHP NEWS
2020
- LiteSpeed:
2121
. Updated to LiteSpeed SAPI V7.5 (Fixed clean shutdown). (George Wang)
2222

23+
- MySQLnd:
24+
. Fixed bug #78179 (MariaDB server version incorrectly detected). (cmb)
25+
2326
- Standard:
2427
. Fixed bug #69100 (Bus error from stream_copy_to_stream (file -> SSL stream)
2528
with invalid length). (Nikita)

ext/mysqlnd/mysqlnd_connection.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,6 +1485,14 @@ MYSQLND_METHOD(mysqlnd_conn_data, get_server_version)(const MYSQLND_CONN_DATA *
14851485
return 0;
14861486
}
14871487

1488+
#define MARIA_DB_VERSION_HACK_PREFIX "5.5.5-"
1489+
1490+
if (conn->server_capabilities & CLIENT_PLUGIN_AUTH
1491+
&& !strncmp(p, MARIA_DB_VERSION_HACK_PREFIX, sizeof(MARIA_DB_VERSION_HACK_PREFIX)-1))
1492+
{
1493+
p += sizeof(MARIA_DB_VERSION_HACK_PREFIX)-1;
1494+
}
1495+
14881496
major = ZEND_STRTOL(p, &p, 10);
14891497
p += 1; /* consume the dot */
14901498
minor = ZEND_STRTOL(p, &p, 10);

0 commit comments

Comments
 (0)