Skip to content

Commit

Permalink
Drop support for libmysqlclient < 5.5
Browse files Browse the repository at this point in the history
Given how little maintenance the libmysqlclient driver sees, be
more aggressive in dropping old version support here.
  • Loading branch information
nikic committed Sep 17, 2020
1 parent e7f98f8 commit 5cb8b04
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 36 deletions.
2 changes: 1 addition & 1 deletion UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ PHP 8.0 UPGRADE NOTES

- MySQLi / PDO MySQL:
. When mysqlnd is not used (which is the default and recommended option),
the minimum supported libmysqlclient version is now 5.1.
the minimum supported libmysqlclient version is now 5.5.
. mysqli_result now implements IteratorAggregate (instead of Traversable).

- PGSQL / PDO PGSQL:
Expand Down
10 changes: 0 additions & 10 deletions ext/mysqli/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,6 @@ elif test "$PHP_MYSQLI" != "no"; then
],[
$MYSQLI_LIBLINE
])
dnl
dnl Check the library for mysql_stmt_next_result
dnl
PHP_CHECK_LIBRARY($MYSQL_LIB_NAME, mysql_stmt_next_result,
[
AC_DEFINE(HAVE_STMT_NEXT_RESULT, 1, [ ])
],[
],[
$MYSQLI_LIBLINE
])
fi

dnl Build extension
Expand Down
4 changes: 2 additions & 2 deletions ext/mysqli/mysqli.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ PHP_MINIT_FUNCTION(mysqli)
#ifdef MYSQLND_STRING_TO_INT_CONVERSION
REGISTER_LONG_CONSTANT("MYSQLI_OPT_INT_AND_FLOAT_NATIVE", MYSQLND_OPT_INT_AND_FLOAT_NATIVE, CONST_CS | CONST_PERSISTENT);
#endif
#if (MYSQL_VERSION_ID > 50110 && MYSQL_VERSION_ID < 80000) || (MYSQL_VERSION_ID >= 100000) || defined(MYSQLI_USE_MYSQLND)
#if MYSQL_VERSION_ID < 80000 || MYSQL_VERSION_ID >= 100000 || defined(MYSQLI_USE_MYSQLND)
REGISTER_LONG_CONSTANT("MYSQLI_OPT_SSL_VERIFY_SERVER_CERT", MYSQL_OPT_SSL_VERIFY_SERVER_CERT, CONST_CS | CONST_PERSISTENT);
#endif

Expand Down Expand Up @@ -727,7 +727,7 @@ PHP_MINIT_FUNCTION(mysqli)
REGISTER_LONG_CONSTANT("MYSQLI_BINARY_FLAG", BINARY_FLAG, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MYSQLI_NO_DEFAULT_VALUE_FLAG", NO_DEFAULT_VALUE_FLAG, CONST_CS | CONST_PERSISTENT);

#if (MYSQL_VERSION_ID > 51122 && MYSQL_VERSION_ID < 60000) || (MYSQL_VERSION_ID > 60003) || defined(MYSQLI_USE_MYSQLND)
#if 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);
#endif

Expand Down
24 changes: 3 additions & 21 deletions ext/mysqli/mysqli_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,12 +457,7 @@ mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval *args, unsigned int argc)
case MYSQL_TYPE_NEWDECIMAL:
#endif
{
#if MYSQL_VERSION_ID >= 50107
/* Changed to my_bool in MySQL 5.1. See MySQL Bug #16144 */
my_bool tmp;
#else
zend_ulong tmp = 0;
#endif
stmt->result.buf[ofs].type = IS_STRING;
/*
If the user has called $stmt->store_result() then we have asked
Expand Down Expand Up @@ -1567,7 +1562,8 @@ PHP_FUNCTION(mysqli_next_result) {
}
/* }}} */

#if defined(HAVE_STMT_NEXT_RESULT) && defined(MYSQLI_USE_MYSQLND)
/* TODO: Make these available without mysqlnd */
#if defined(MYSQLI_USE_MYSQLND)
/* {{{ check if there any more query results from a multi query */
PHP_FUNCTION(mysqli_stmt_more_results)
{
Expand Down Expand Up @@ -2244,9 +2240,7 @@ PHP_FUNCTION(mysqli_stmt_attr_set)
MY_STMT *stmt;
zval *mysql_stmt;
zend_long mode_in;
#if MYSQL_VERSION_ID >= 50107
my_bool mode_b;
#endif
unsigned long mode;
zend_long attr;
void *mode_p;
Expand All @@ -2258,7 +2252,6 @@ PHP_FUNCTION(mysqli_stmt_attr_set)
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);

switch (attr) {
#if MYSQL_VERSION_ID >= 50107
case STMT_ATTR_UPDATE_MAX_LENGTH:
if (mode_in != 0 && mode_in != 1) {
zend_argument_value_error(ERROR_ARG_POS(3), "must be 0 or 1 for attribute MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH");
Expand All @@ -2267,7 +2260,6 @@ PHP_FUNCTION(mysqli_stmt_attr_set)
mode_b = (my_bool) mode_in;
mode_p = &mode_b;
break;
#endif
case STMT_ATTR_CURSOR_TYPE:
switch (mode_in) {
case CURSOR_TYPE_NO_CURSOR:
Expand All @@ -2294,9 +2286,7 @@ PHP_FUNCTION(mysqli_stmt_attr_set)
break;
default:
zend_argument_value_error(ERROR_ARG_POS(2), "must be one of "
#if MYSQL_VERSION_ID >= 50107
"MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH, "
#endif
"MYSQLI_STMT_ATTR_PREFETCH_ROWS, or STMT_ATTR_CURSOR_TYPE");
RETURN_THROWS();
}
Expand Down Expand Up @@ -2332,18 +2322,14 @@ PHP_FUNCTION(mysqli_stmt_attr_get)
/* Success corresponds to 0 return value and a non-zero value
* should only happen if the attr/option is unknown */
zend_argument_value_error(ERROR_ARG_POS(2), "must be one of "
#if MYSQL_VERSION_ID >= 50107
"MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH, "
#endif
"MYSQLI_STMT_ATTR_PREFETCH_ROWS, or STMT_ATTR_CURSOR_TYPE");
RETURN_THROWS();
}


#if MYSQL_VERSION_ID >= 50107
if (attr == STMT_ATTR_UPDATE_MAX_LENGTH)
value = *((my_bool *)&value);
#endif
RETURN_LONG((unsigned long)value);
}
/* }}} */
Expand Down Expand Up @@ -2488,11 +2474,7 @@ PHP_FUNCTION(mysqli_stmt_store_result)
stmt->stmt->fields[i].type == MYSQL_TYPE_LONG_BLOB ||
stmt->stmt->fields[i].type == MYSQL_TYPE_GEOMETRY))
{
#if MYSQL_VERSION_ID >= 50107
my_bool tmp=1;
#else
uint32_t tmp=1;
#endif
my_bool tmp = 1;
mysql_stmt_attr_set(stmt->stmt, STMT_ATTR_UPDATE_MAX_LENGTH, &tmp);
break;
}
Expand Down
2 changes: 0 additions & 2 deletions ext/mysqli/mysqli_mysqlnd.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,4 @@
#define mysqli_async_query(c, q, l) mysqlnd_async_query((c), (q), (l))
#define mysqli_change_user_silent(c, u, p, d, p_len) mysqlnd_change_user_ex((c), (u), (p), (d), TRUE, (size_t)(p_len))

#define HAVE_STMT_NEXT_RESULT

#endif

0 comments on commit 5cb8b04

Please sign in to comment.