mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
Merge branch 'PHP-8.1'
* PHP-8.1: Strip MariaDB 10 prefix Fix news entry for 8.1.2
This commit is contained in:
commit
262d4c220b
21
ext/mysqli/tests/gh7932.phpt
Normal file
21
ext/mysqli/tests/gh7932.phpt
Normal file
@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
GH-7972 (MariaDB version prefix not always stripped)
|
||||
--EXTENSIONS--
|
||||
mysqli
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once 'skipifconnectfailure.inc';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once "connect.inc";
|
||||
|
||||
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
||||
$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
|
||||
|
||||
// It seems we can only test the happy path...
|
||||
if (str_starts_with($mysqli->server_info, '5.5.5-')) {
|
||||
print("Expecting stripped prefix. Found: " . $mysqli->server_info . "\n");
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
@ -1278,14 +1278,6 @@ 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);
|
||||
|
@ -41,6 +41,8 @@ const char mysqlnd_read_body_name[] = "mysqlnd_read_body";
|
||||
#define ERROR_MARKER 0xFF
|
||||
#define EODATA_MARKER 0xFE
|
||||
|
||||
#define MARIADB_RPL_VERSION_HACK "5.5.5-"
|
||||
|
||||
/* {{{ mysqlnd_command_to_text */
|
||||
const char * const mysqlnd_command_to_text[COM_END] =
|
||||
{
|
||||
@ -369,6 +371,11 @@ php_mysqlnd_greet_read(MYSQLND_CONN_DATA * conn, void * _packet)
|
||||
DBG_RETURN(PASS);
|
||||
}
|
||||
|
||||
/* MariaDB always sends 5.5.5 before version string: 5.5.5 was never released,
|
||||
so just ignore it */
|
||||
if (!strncmp((char *) p, MARIADB_RPL_VERSION_HACK, sizeof(MARIADB_RPL_VERSION_HACK) - 1))
|
||||
p+= sizeof(MARIADB_RPL_VERSION_HACK) - 1;
|
||||
|
||||
packet->server_version = estrdup((char *)p);
|
||||
p+= strlen(packet->server_version) + 1; /* eat the '\0' */
|
||||
BAIL_IF_NO_MORE_DATA;
|
||||
|
Loading…
Reference in New Issue
Block a user