Remove support for libmysqlclient 5.0

Closes GH-5391.
This commit is contained in:
Nikita Popov 2020-04-15 12:04:15 +02:00
parent baabb5398f
commit 8597ec00d4
9 changed files with 10 additions and 68 deletions

View File

@ -578,6 +578,10 @@ PHP 8.0 UPGRADE NOTES
- MBString:
. The Unicode data tables have been updated to version 13.0.0.
- MySQLi / PDO MySQL:
. When mysqlnd is not used (which is the default and recommended option),
the minimum supported libmysqlclient version is now 5.1.
========================================
10. New Global Constants
========================================

View File

@ -711,17 +711,13 @@ PHP_MINIT_FUNCTION(mysqli)
/* for mysqli_stmt_set_attr */
REGISTER_LONG_CONSTANT("MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH", STMT_ATTR_UPDATE_MAX_LENGTH, CONST_CS | CONST_PERSISTENT);
#if MYSQL_VERSION_ID > 50003 || defined(MYSQLI_USE_MYSQLND)
REGISTER_LONG_CONSTANT("MYSQLI_STMT_ATTR_CURSOR_TYPE", STMT_ATTR_CURSOR_TYPE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MYSQLI_CURSOR_TYPE_NO_CURSOR", CURSOR_TYPE_NO_CURSOR, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MYSQLI_CURSOR_TYPE_READ_ONLY", CURSOR_TYPE_READ_ONLY, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MYSQLI_CURSOR_TYPE_FOR_UPDATE", CURSOR_TYPE_FOR_UPDATE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MYSQLI_CURSOR_TYPE_SCROLLABLE", CURSOR_TYPE_SCROLLABLE, CONST_CS | CONST_PERSISTENT);
#endif
#if MYSQL_VERSION_ID > 50007 || defined(MYSQLI_USE_MYSQLND)
REGISTER_LONG_CONSTANT("MYSQLI_STMT_ATTR_PREFETCH_ROWS", STMT_ATTR_PREFETCH_ROWS, CONST_CS | CONST_PERSISTENT);
#endif
/* column information */
REGISTER_LONG_CONSTANT("MYSQLI_NOT_NULL_FLAG", NOT_NULL_FLAG, CONST_CS | CONST_PERSISTENT);
@ -739,9 +735,7 @@ PHP_MINIT_FUNCTION(mysqli)
REGISTER_LONG_CONSTANT("MYSQLI_GROUP_FLAG", GROUP_FLAG, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MYSQLI_ENUM_FLAG", ENUM_FLAG, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MYSQLI_BINARY_FLAG", BINARY_FLAG, CONST_CS | CONST_PERSISTENT);
#if MYSQL_VERSION_ID > 50001 || defined(MYSQLI_USE_MYSQLND)
REGISTER_LONG_CONSTANT("MYSQLI_NO_DEFAULT_VALUE_FLAG", NO_DEFAULT_VALUE_FLAG, CONST_CS | CONST_PERSISTENT);
#endif
#if (MYSQL_VERSION_ID > 51122 && MYSQL_VERSION_ID < 60000) || (MYSQL_VERSION_ID > 60003) || defined(MYSQLI_USE_MYSQLND)
REGISTER_LONG_CONSTANT("MYSQLI_ON_UPDATE_NOW_FLAG", ON_UPDATE_NOW_FLAG, CONST_CS | CONST_PERSISTENT);
@ -776,10 +770,8 @@ PHP_MINIT_FUNCTION(mysqli)
#ifdef FIELD_TYPE_JSON
REGISTER_LONG_CONSTANT("MYSQLI_TYPE_JSON", FIELD_TYPE_JSON, CONST_CS | CONST_PERSISTENT);
#endif
#if MYSQL_VERSION_ID > 50002 || defined(MYSQLI_USE_MYSQLND)
REGISTER_LONG_CONSTANT("MYSQLI_TYPE_NEWDECIMAL", FIELD_TYPE_NEWDECIMAL, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MYSQLI_TYPE_BIT", FIELD_TYPE_BIT, CONST_CS | CONST_PERSISTENT);
#endif
REGISTER_LONG_CONSTANT("MYSQLI_SET_CHARSET_NAME", MYSQL_SET_CHARSET_NAME, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MYSQLI_SET_CHARSET_DIR", MYSQL_SET_CHARSET_DIR, CONST_CS | CONST_PERSISTENT);
@ -1138,7 +1130,6 @@ void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, zend
if (row[i]) {
zval res;
#if MYSQL_VERSION_ID > 50002
if (mysql_fetch_field_direct(result, i)->type == MYSQL_TYPE_BIT) {
my_ulonglong llval;
char tmp[22];
@ -1158,10 +1149,7 @@ void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, zend
*/
snprintf(tmp, sizeof(tmp), (mysql_fetch_field_direct(result, i)->flags & UNSIGNED_FLAG)? MYSQLI_LLU_SPEC : MYSQLI_LL_SPEC, llval);
ZVAL_STRING(&res, tmp);
} else
#endif
{
} else {
ZVAL_STRINGL(&res, row[i], field_len[i]);
}

View File

@ -79,13 +79,11 @@ class mysqli
*/
public function debug(string $debug_options) {}
#ifdef HAVE_MYSQLI_GET_CHARSET
/**
* @return object|null
* @alias mysqli_get_charset
*/
public function get_charset() {}
#endif
/**
* @return string|null
@ -233,13 +231,11 @@ class mysqli
*/
public function select_db(string $database) {}
#ifdef HAVE_MYSQLI_SET_CHARSET
/**
* @return bool
* @alias mysqli_set_charset
*/
public function set_charset(string $charset) {}
#endif
/**
* @param mixed $value

View File

@ -459,9 +459,7 @@ mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval *args, unsigned int argc)
break;
case MYSQL_TYPE_LONGLONG:
#if MYSQL_VERSION_ID > 50002 || defined(MYSQLI_USE_MYSQLND)
case MYSQL_TYPE_BIT:
#endif
stmt->result.buf[ofs].type = IS_STRING;
stmt->result.buf[ofs].buflen = sizeof(my_ulonglong);
stmt->result.buf[ofs].val = (char *)emalloc(stmt->result.buf[ofs].buflen);
@ -611,7 +609,7 @@ PHP_FUNCTION(mysqli_change_user)
char *user, *password, *dbname;
size_t user_len, password_len, dbname_len;
zend_ulong rc;
#if !defined(MYSQLI_USE_MYSQLND) && defined(HAVE_MYSQLI_SET_CHARSET)
#if !defined(MYSQLI_USE_MYSQLND)
const CHARSET_INFO * old_charset;
#endif
@ -620,7 +618,7 @@ PHP_FUNCTION(mysqli_change_user)
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
#if !defined(MYSQLI_USE_MYSQLND) && defined(HAVE_MYSQLI_SET_CHARSET)
#if !defined(MYSQLI_USE_MYSQLND)
old_charset = mysql->mysql->charset;
#endif
@ -634,7 +632,7 @@ PHP_FUNCTION(mysqli_change_user)
if (rc) {
RETURN_FALSE;
}
#if !defined(MYSQLI_USE_MYSQLND) && defined(HAVE_MYSQLI_SET_CHARSET)
#if !defined(MYSQLI_USE_MYSQLND)
if (mysql_get_server_version(mysql->mysql) < 50123L) {
/*
Request the current charset, or it will be reset to the system one.
@ -1024,12 +1022,9 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS)
}
case IS_STRING:
if (stmt->stmt->bind[i].buffer_type == MYSQL_TYPE_LONGLONG
#if MYSQL_VERSION_ID > 50002
|| stmt->stmt->bind[i].buffer_type == MYSQL_TYPE_BIT
#endif
) {
my_bool uns = (stmt->stmt->fields[i].flags & UNSIGNED_FLAG)? 1:0;
#if MYSQL_VERSION_ID > 50002
if (stmt->stmt->bind[i].buffer_type == MYSQL_TYPE_BIT) {
switch (stmt->result.buf[i].output_len) {
case 8:llval = (my_ulonglong) bit_uint8korr(stmt->result.buf[i].val);break;
@ -1041,9 +1036,7 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS)
case 2:llval = (my_ulonglong) bit_uint2korr(stmt->result.buf[i].val);break;
case 1:llval = (my_ulonglong) uint1korr(stmt->result.buf[i].val);break;
}
} else
#endif
{
} else {
llval= *(my_ulonglong *) stmt->result.buf[i].val;
}
#if SIZEOF_ZEND_LONG==8
@ -1065,14 +1058,10 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS)
ZEND_TRY_ASSIGN_REF_LONG(result, llval);
}
} else {
#if defined(MYSQL_DATA_TRUNCATED) && MYSQL_VERSION_ID > 50002
if (ret == MYSQL_DATA_TRUNCATED && *(stmt->stmt->bind[i].error) != 0) {
/* result was truncated */
ZEND_TRY_ASSIGN_REF_STRINGL(result, stmt->result.buf[i].val, stmt->stmt->bind[i].buffer_length);
} else {
#else
{
#endif
ZEND_TRY_ASSIGN_REF_STRINGL(result, stmt->result.buf[i].val, stmt->result.buf[i].output_len);
}
}

View File

@ -458,10 +458,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_mysqli_debug, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, debug_options, IS_STRING, 0)
ZEND_END_ARG_INFO()
#if defined(HAVE_MYSQLI_GET_CHARSET)
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_mysqli_get_charset, 0, 0, 0)
ZEND_END_ARG_INFO()
#endif
#define arginfo_class_mysqli_get_charset arginfo_class_mysqli_character_set_name
#define arginfo_class_mysqli_get_client_info arginfo_class_mysqli_character_set_name
@ -544,11 +541,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_mysqli_select_db, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, database, IS_STRING, 0)
ZEND_END_ARG_INFO()
#if defined(HAVE_MYSQLI_SET_CHARSET)
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_mysqli_set_charset, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, charset, IS_STRING, 0)
ZEND_END_ARG_INFO()
#endif
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_mysqli_options, 0, 0, 2)
ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
@ -796,9 +791,6 @@ ZEND_FUNCTION(mysqli_use_result);
ZEND_FUNCTION(mysqli_warning_count);
ZEND_FUNCTION(mysqli_refresh);
ZEND_FUNCTION(mysqli_link_construct);
#if defined(HAVE_MYSQLI_GET_CHARSET)
ZEND_FUNCTION(mysqli_get_charset);
#endif
#if defined(MYSQLI_USE_MYSQLND)
ZEND_FUNCTION(mysqli_get_connection_stats);
#endif
@ -809,9 +801,6 @@ ZEND_FUNCTION(mysqli_poll);
#if defined(MYSQLI_USE_MYSQLND)
ZEND_FUNCTION(mysqli_reap_async_query);
#endif
#if defined(HAVE_MYSQLI_SET_CHARSET)
ZEND_FUNCTION(mysqli_set_charset);
#endif
ZEND_FUNCTION(mysqli_result_construct);
#if defined(MYSQLI_USE_MYSQLND)
ZEND_FUNCTION(mysqli_fetch_all);
@ -955,9 +944,7 @@ static const zend_function_entry class_mysqli_methods[] = {
ZEND_ME_MAPPING(connect, mysqli_connect, arginfo_class_mysqli_connect, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(dump_debug_info, mysqli_dump_debug_info, arginfo_class_mysqli_dump_debug_info, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(debug, mysqli_debug, arginfo_class_mysqli_debug, ZEND_ACC_PUBLIC)
#if defined(HAVE_MYSQLI_GET_CHARSET)
ZEND_ME_MAPPING(get_charset, mysqli_get_charset, arginfo_class_mysqli_get_charset, ZEND_ACC_PUBLIC)
#endif
ZEND_ME_MAPPING(get_client_info, mysqli_get_client_info, arginfo_class_mysqli_get_client_info, ZEND_ACC_PUBLIC)
#if defined(MYSQLI_USE_MYSQLND)
ZEND_ME_MAPPING(get_connection_stats, mysqli_get_connection_stats, arginfo_class_mysqli_get_connection_stats, ZEND_ACC_PUBLIC)
@ -986,9 +973,7 @@ static const zend_function_entry class_mysqli_methods[] = {
ZEND_ME_MAPPING(rollback, mysqli_rollback, arginfo_class_mysqli_rollback, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(savepoint, mysqli_savepoint, arginfo_class_mysqli_savepoint, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(select_db, mysqli_select_db, arginfo_class_mysqli_select_db, ZEND_ACC_PUBLIC)
#if defined(HAVE_MYSQLI_SET_CHARSET)
ZEND_ME_MAPPING(set_charset, mysqli_set_charset, arginfo_class_mysqli_set_charset, ZEND_ACC_PUBLIC)
#endif
ZEND_ME_MAPPING(options, mysqli_options, arginfo_class_mysqli_options, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(set_opt, mysqli_options, arginfo_class_mysqli_set_opt, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(ssl_set, mysqli_ssl_set, arginfo_class_mysqli_ssl_set, ZEND_ACC_PUBLIC)

View File

@ -1035,7 +1035,6 @@ PHP_FUNCTION(mysqli_stmt_get_warnings)
}
/* }}} */
#ifdef HAVE_MYSQLI_SET_CHARSET
/* {{{ proto bool mysqli_set_charset(object link, string csname)
sets client character set */
PHP_FUNCTION(mysqli_set_charset)
@ -1056,9 +1055,7 @@ PHP_FUNCTION(mysqli_set_charset)
RETURN_TRUE;
}
/* }}} */
#endif
#ifdef HAVE_MYSQLI_GET_CHARSET
/* {{{ proto object mysqli_get_charset(object link) U
returns a character set object */
PHP_FUNCTION(mysqli_get_charset)
@ -1115,7 +1112,6 @@ PHP_FUNCTION(mysqli_get_charset)
add_property_string(return_value, "comment", (comment) ? (char *)comment : "");
}
/* }}} */
#endif
#if !defined(MYSQLI_USE_MYSQLND)
extern char * mysqli_escape_string_for_tx_name_in_comment(const char * const name);

View File

@ -24,16 +24,6 @@
#define MYSQL_UNIX_ADDR PHP_MYSQL_UNIX_SOCK_ADDR
#endif
/* character set support */
#if defined(MYSQLND_VERSION_ID) || MYSQL_VERSION_ID > 50009
#define HAVE_MYSQLI_GET_CHARSET
#endif
#if defined(MYSQLND_VERSION_ID) || MYSQL_VERSION_ID > 50005
#define HAVE_MYSQLI_SET_CHARSET
#endif
extern const zend_function_entry mysqli_functions[];
extern const zend_function_entry mysqli_link_methods[];
extern const zend_function_entry mysqli_stmt_methods[];

View File

@ -787,12 +787,10 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options)
#endif
}
#ifdef PDO_MYSQL_HAS_CHARSET
if (vars[0].optval && mysql_options(H->server, MYSQL_SET_CHARSET_NAME, vars[0].optval)) {
pdo_mysql_error(dbh);
goto cleanup;
}
#endif
dbname = vars[1].optval;
host = vars[2].optval;

View File

@ -28,10 +28,6 @@
# define PDO_MYSQL_PARAM_BIND MYSQL_BIND
#endif
#if (MYSQL_VERSION_ID >= 40113 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID >= 50007 || defined(MYSQL_USE_MYSQLND)
# define PDO_MYSQL_HAS_CHARSET
#endif
#if defined(PDO_USE_MYSQLND) && PHP_DEBUG && !defined(PHP_WIN32)
#define PDO_DBG_ENABLED 1