Remove unsupported mysqlnd options

This commit is contained in:
Kamil Tekiela 2024-08-15 23:16:19 +02:00
parent 082b964dfa
commit 2446500d97
3 changed files with 10 additions and 57 deletions

View File

@ -1160,45 +1160,20 @@ static int mysqli_options_get_option_zval_type(int option)
case MYSQLND_OPT_NET_READ_BUFFER_SIZE: case MYSQLND_OPT_NET_READ_BUFFER_SIZE:
case MYSQLND_OPT_INT_AND_FLOAT_NATIVE: case MYSQLND_OPT_INT_AND_FLOAT_NATIVE:
case MYSQL_OPT_CONNECT_TIMEOUT: case MYSQL_OPT_CONNECT_TIMEOUT:
#ifdef MYSQL_REPORT_DATA_TRUNCATION
case MYSQL_REPORT_DATA_TRUNCATION:
#endif
case MYSQL_OPT_LOCAL_INFILE: case MYSQL_OPT_LOCAL_INFILE:
case MYSQL_OPT_NAMED_PIPE: case MYSQL_OPT_NAMED_PIPE:
#ifdef MYSQL_OPT_PROTOCOL
case MYSQL_OPT_PROTOCOL: case MYSQL_OPT_PROTOCOL:
#endif /* MySQL 4.1.0 */
case MYSQL_OPT_READ_TIMEOUT: case MYSQL_OPT_READ_TIMEOUT:
case MYSQL_OPT_WRITE_TIMEOUT: case MYSQL_OPT_WRITE_TIMEOUT:
#ifdef MYSQL_OPT_GUESS_CONNECTION /* removed in MySQL-8.0 */
case MYSQL_OPT_GUESS_CONNECTION:
case MYSQL_OPT_USE_EMBEDDED_CONNECTION:
case MYSQL_OPT_USE_REMOTE_CONNECTION:
case MYSQL_SECURE_AUTH:
#endif
#ifdef MYSQL_OPT_RECONNECT
case MYSQL_OPT_RECONNECT:
#endif /* MySQL 5.0.13 */
#ifdef MYSQL_OPT_SSL_VERIFY_SERVER_CERT
case MYSQL_OPT_SSL_VERIFY_SERVER_CERT: case MYSQL_OPT_SSL_VERIFY_SERVER_CERT:
#endif /* MySQL 5.0.23 */
#ifdef MYSQL_OPT_COMPRESS
case MYSQL_OPT_COMPRESS: case MYSQL_OPT_COMPRESS:
#endif /* mysqlnd @ PHP 5.3.2 */
case MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS: case MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS:
return IS_LONG; return IS_LONG;
#ifdef MYSQL_SHARED_MEMORY_BASE_NAME
case MYSQL_SHARED_MEMORY_BASE_NAME:
#endif /* MySQL 4.1.0 */
#ifdef MYSQL_SET_CLIENT_IP
case MYSQL_SET_CLIENT_IP:
#endif /* MySQL 4.1.1 */
case MYSQL_READ_DEFAULT_FILE: case MYSQL_READ_DEFAULT_FILE:
case MYSQL_READ_DEFAULT_GROUP: case MYSQL_READ_DEFAULT_GROUP:
case MYSQL_INIT_COMMAND: case MYSQL_INIT_COMMAND:
case MYSQL_SET_CHARSET_NAME: case MYSQL_SET_CHARSET_NAME:
case MYSQL_SET_CHARSET_DIR:
case MYSQL_SERVER_PUBLIC_KEY: case MYSQL_SERVER_PUBLIC_KEY:
case MYSQL_OPT_LOAD_DATA_LOCAL_DIR: case MYSQL_OPT_LOAD_DATA_LOCAL_DIR:
return IS_STRING; return IS_STRING;

View File

@ -1444,10 +1444,6 @@ MYSQLND_METHOD(mysqlnd_conn_data, set_client_option)(MYSQLND_CONN_DATA * const c
} }
case MYSQL_READ_DEFAULT_FILE: case MYSQL_READ_DEFAULT_FILE:
case MYSQL_READ_DEFAULT_GROUP: case MYSQL_READ_DEFAULT_GROUP:
#ifdef WHEN_SUPPORTED_BY_MYSQLI
case MYSQL_SET_CLIENT_IP:
case MYSQL_REPORT_DATA_TRUNCATION:
#endif
/* currently not supported. Todo!! */ /* currently not supported. Todo!! */
break; break;
case MYSQL_SET_CHARSET_NAME: case MYSQL_SET_CHARSET_NAME:
@ -1475,18 +1471,6 @@ MYSQLND_METHOD(mysqlnd_conn_data, set_client_option)(MYSQLND_CONN_DATA * const c
conn->options->protocol = *(unsigned int*) value; conn->options->protocol = *(unsigned int*) value;
} }
break; break;
#ifdef WHEN_SUPPORTED_BY_MYSQLI
case MYSQL_SET_CHARSET_DIR:
case MYSQL_OPT_RECONNECT:
/* we don't need external character sets, all character sets are
compiled in. For compatibility we just ignore this setting.
Same for protocol, we don't support old protocol */
case MYSQL_OPT_USE_REMOTE_CONNECTION:
case MYSQL_OPT_USE_EMBEDDED_CONNECTION:
case MYSQL_OPT_GUESS_CONNECTION:
/* todo: throw an error, we don't support embedded */
break;
#endif
case MYSQLND_OPT_MAX_ALLOWED_PACKET: case MYSQLND_OPT_MAX_ALLOWED_PACKET:
if (*(unsigned int*) value > (1<<16)) { if (*(unsigned int*) value > (1<<16)) {
conn->options->max_allowed_packet = *(unsigned int*) value; conn->options->max_allowed_packet = *(unsigned int*) value;
@ -1522,12 +1506,6 @@ MYSQLND_METHOD(mysqlnd_conn_data, set_client_option)(MYSQLND_CONN_DATA * const c
DBG_INF_FMT("%d left", zend_hash_num_elements(conn->options->connect_attr)); DBG_INF_FMT("%d left", zend_hash_num_elements(conn->options->connect_attr));
} }
break; break;
#ifdef WHEN_SUPPORTED_BY_MYSQLI
case MYSQL_SHARED_MEMORY_BASE_NAME:
case MYSQL_OPT_USE_RESULT:
case MYSQL_SECURE_AUTH:
/* not sure, todo ? */
#endif
default: default:
ret = FAIL; ret = FAIL;
} }

View File

@ -199,21 +199,21 @@ typedef enum mysqlnd_client_option
MYSQL_INIT_COMMAND, MYSQL_INIT_COMMAND,
MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_FILE,
MYSQL_READ_DEFAULT_GROUP, MYSQL_READ_DEFAULT_GROUP,
MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_DIR, /* Unsupported by mysqlnd */
MYSQL_SET_CHARSET_NAME, MYSQL_SET_CHARSET_NAME,
MYSQL_OPT_LOCAL_INFILE, MYSQL_OPT_LOCAL_INFILE,
MYSQL_OPT_PROTOCOL, MYSQL_OPT_PROTOCOL,
MYSQL_SHARED_MEMORY_BASE_NAME, MYSQL_SHARED_MEMORY_BASE_NAME, /* Unsupported by mysqlnd */
MYSQL_OPT_READ_TIMEOUT, MYSQL_OPT_READ_TIMEOUT,
MYSQL_OPT_WRITE_TIMEOUT, MYSQL_OPT_WRITE_TIMEOUT,
MYSQL_OPT_USE_RESULT, MYSQL_OPT_USE_RESULT, /* Unsupported by mysqlnd */
MYSQL_OPT_USE_REMOTE_CONNECTION, MYSQL_OPT_USE_REMOTE_CONNECTION, /* Unsupported by mysqlnd; removed in MySQL-8.0 */
MYSQL_OPT_USE_EMBEDDED_CONNECTION, MYSQL_OPT_USE_EMBEDDED_CONNECTION, /* Unsupported by mysqlnd; removed in MySQL-8.0 */
MYSQL_OPT_GUESS_CONNECTION, MYSQL_OPT_GUESS_CONNECTION, /* Unsupported by mysqlnd; removed in MySQL-8.0 */
MYSQL_SET_CLIENT_IP, MYSQL_SET_CLIENT_IP, /* Unsupported by mysqlnd */
MYSQL_SECURE_AUTH, MYSQL_SECURE_AUTH, /* Unsupported by mysqlnd; removed in MySQL-8.0 */
MYSQL_REPORT_DATA_TRUNCATION, MYSQL_REPORT_DATA_TRUNCATION, /* Unsupported by mysqlnd */
MYSQL_OPT_RECONNECT, MYSQL_OPT_RECONNECT, /* Unsupported by mysqlnd */
MYSQL_OPT_SSL_VERIFY_SERVER_CERT, MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
MYSQL_PLUGIN_DIR, MYSQL_PLUGIN_DIR,
MYSQL_DEFAULT_AUTH, MYSQL_DEFAULT_AUTH,