Commit 3ed4d2a82bd for php.net

commit 3ed4d2a82bd2961595b3af18ab969e86e4afe6ab
Author: Kamil Tekiela <tekiela246@gmail.com>
Date:   Tue Jan 20 13:06:52 2026 +0000

    Drop extraneous parameter (#20977)

diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS
index 2132006540c..1b041da5aff 100644
--- a/UPGRADING.INTERNALS
+++ b/UPGRADING.INTERNALS
@@ -74,6 +74,10 @@ PHP 8.6 INTERNALS UPGRADE NOTES
 - ext/mbstring:
   . Added GB18030-2022 to default encoding list for zh-CN.

+- ext/mysqlnd:
+  . Dropped session_options parameter from all methods in mysqlnd_auth.
+    The same information is present in conn->options and should be used instead.
+
 - ext/standard:
   . _php_error_log() now has a formal return type of zend_result.
   . _php_error_log() now accepts zend_string* values instead of char*.
diff --git a/ext/mysqlnd/mysqlnd_auth.c b/ext/mysqlnd/mysqlnd_auth.c
index 691375b1a69..07c39383090 100644
--- a/ext/mysqlnd/mysqlnd_auth.c
+++ b/ext/mysqlnd/mysqlnd_auth.c
@@ -43,7 +43,6 @@ mysqlnd_run_authentication(
 			const MYSQLND_STRING auth_plugin_data,
 			const char * const auth_protocol,
 			const unsigned int charset_no,
-			const MYSQLND_SESSION_OPTIONS * const session_options,
 			const zend_ulong mysql_flags,
 			const bool silent,
 			const bool is_change_user
@@ -110,7 +109,7 @@ mysqlnd_run_authentication(
 				scrambled_data = auth_plugin->methods.get_auth_data(
 					NULL, &scrambled_data_len, conn, user, passwd,
 					passwd_len, plugin_data, plugin_data_len,
-					session_options, conn->protocol_frame_codec->data,
+					conn->protocol_frame_codec->data,
 					mysql_flags);
 			}

@@ -118,7 +117,7 @@ mysqlnd_run_authentication(
 				goto end;
 			}
 			if (FALSE == is_change_user) {
-				ret = mysqlnd_auth_handshake(conn, user, passwd, passwd_len, db, db_len, session_options, mysql_flags,
+				ret = mysqlnd_auth_handshake(conn, user, passwd, passwd_len, db, db_len, mysql_flags,
 											charset_no,
 											first_call,
 											requested_protocol,
@@ -177,14 +176,13 @@ static enum_func_status
 mysqlnd_switch_to_ssl_if_needed(MYSQLND_CONN_DATA * const conn,
 								unsigned int charset_no,
 								const size_t server_capabilities,
-								const MYSQLND_SESSION_OPTIONS * const session_options,
 								const zend_ulong mysql_flags)
 {
 	enum_func_status ret = FAIL;
 	const MYSQLND_CHARSET * charset;
 	DBG_ENTER("mysqlnd_switch_to_ssl_if_needed");

-	if (session_options->charset_name && (charset = mysqlnd_find_charset_name(session_options->charset_name))) {
+	if (conn->options->charset_name && (charset = mysqlnd_find_charset_name(conn->options->charset_name))) {
 		charset_no = charset->nr;
 	}

@@ -210,18 +208,17 @@ mysqlnd_connect_run_authentication(
 			const char * const authentication_protocol,
 			const unsigned int charset_no,
 			const size_t server_capabilities,
-			const MYSQLND_SESSION_OPTIONS * const session_options,
 			const zend_ulong mysql_flags
 			)
 {
 	enum_func_status ret = FAIL;
 	DBG_ENTER("mysqlnd_connect_run_authentication");

-	ret = mysqlnd_switch_to_ssl_if_needed(conn, charset_no, server_capabilities, session_options, mysql_flags);
+	ret = mysqlnd_switch_to_ssl_if_needed(conn, charset_no, server_capabilities, mysql_flags);
 	if (PASS == ret) {
 		ret = mysqlnd_run_authentication(conn, user, passwd, passwd_len, db, db_len,
 										 authentication_plugin_data, authentication_protocol,
-										 charset_no, session_options, mysql_flags, FALSE /*silent*/, FALSE/*is_change*/);
+										 charset_no, mysql_flags, FALSE /*silent*/, FALSE/*is_change*/);
 	}
 	DBG_RETURN(ret);
 }
@@ -236,7 +233,6 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
 							  const size_t passwd_len,
 							  const char * const db,
 							  const size_t db_len,
-							  const MYSQLND_SESSION_OPTIONS * const session_options,
 							  const zend_ulong mysql_flags,
 							  const unsigned int server_charset_no,
 							  const bool use_full_blown_auth_packet,
@@ -281,8 +277,8 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
 		conn->payload_decoder_factory->m.init_auth_packet(&auth_packet);

 		auth_packet.client_flags = mysql_flags;
-		auth_packet.max_packet_size = session_options->max_allowed_packet;
-		if (session_options->charset_name && (charset = mysqlnd_find_charset_name(session_options->charset_name))) {
+		auth_packet.max_packet_size = conn->options->max_allowed_packet;
+		if (conn->options->charset_name && (charset = mysqlnd_find_charset_name(conn->options->charset_name))) {
 			auth_packet.charset_no	= charset->nr;
 		} else {
 			auth_packet.charset_no	= server_charset_no;
@@ -556,7 +552,6 @@ mysqlnd_native_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self
 								  size_t * auth_data_len,
 								  MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd,
 								  const size_t passwd_len, zend_uchar * auth_plugin_data, const size_t auth_plugin_data_len,
-								  const MYSQLND_SESSION_OPTIONS * const session_options,
 								  const MYSQLND_PFC_DATA * const pfc_data,
 								  const zend_ulong mysql_flags
 								 )
@@ -617,7 +612,6 @@ mysqlnd_pam_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self,
 							   size_t * auth_data_len,
 							   MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd,
 							   const size_t passwd_len, zend_uchar * auth_plugin_data, const size_t auth_plugin_data_len,
-							   const MYSQLND_SESSION_OPTIONS * const session_options,
 							   const MYSQLND_PFC_DATA * const pfc_data,
 							   const zend_ulong mysql_flags
 							  )
@@ -820,7 +814,6 @@ mysqlnd_sha256_public_encrypt(MYSQLND_CONN_DATA * conn, mysqlnd_rsa_t server_pub
 /* {{{ mysqlnd_sha256_get_rsa_key */
 static mysqlnd_rsa_t
 mysqlnd_sha256_get_rsa_key(MYSQLND_CONN_DATA * conn,
-						   const MYSQLND_SESSION_OPTIONS * const session_options,
 						   const MYSQLND_PFC_DATA * const pfc_data
 						  )
 {
@@ -894,7 +887,6 @@ mysqlnd_sha256_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self
 								  size_t * auth_data_len,
 								  MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd,
 								  const size_t passwd_len, zend_uchar * auth_plugin_data, const size_t auth_plugin_data_len,
-								  const MYSQLND_SESSION_OPTIONS * const session_options,
 								  const MYSQLND_PFC_DATA * const pfc_data,
 								  const zend_ulong mysql_flags
 								 )
@@ -916,7 +908,7 @@ mysqlnd_sha256_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self
 		ret[passwd_len] = '\0';
 	} else {
 		*auth_data_len = 0;
-		server_public_key = mysqlnd_sha256_get_rsa_key(conn, session_options, pfc_data);
+		server_public_key = mysqlnd_sha256_get_rsa_key(conn, pfc_data);

 		if (server_public_key) {
 			ALLOCA_FLAG(use_heap);
@@ -1095,7 +1087,6 @@ mysqlnd_caching_sha2_get_auth_data(struct st_mysqlnd_authentication_plugin * sel
 								   size_t * auth_data_len,
 							 	   MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd,
 								   const size_t passwd_len, zend_uchar * auth_plugin_data, const size_t auth_plugin_data_len,
-								   const MYSQLND_SESSION_OPTIONS * const session_options,
 								   const MYSQLND_PFC_DATA * const pfc_data,
 								   const zend_ulong mysql_flags
 								  )
diff --git a/ext/mysqlnd/mysqlnd_auth.h b/ext/mysqlnd/mysqlnd_auth.h
index 2ba2321a77a..9ce14a2fc52 100644
--- a/ext/mysqlnd/mysqlnd_auth.h
+++ b/ext/mysqlnd/mysqlnd_auth.h
@@ -24,7 +24,6 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
 						const size_t passwd_len,
 						const char * const db,
 						const size_t db_len,
-						const MYSQLND_SESSION_OPTIONS * const session_options,
 						const zend_ulong mysql_flags,
 						const unsigned int server_charset_no,
 						const bool use_full_blown_auth_packet,
@@ -75,7 +74,6 @@ mysqlnd_connect_run_authentication(
 			const char * const authentication_protocol,
 			const unsigned int charset_no,
 			const size_t server_capabilities,
-			const MYSQLND_SESSION_OPTIONS * const session_options,
 			const zend_ulong mysql_flags
 			);

@@ -90,7 +88,6 @@ mysqlnd_run_authentication(
 			const MYSQLND_STRING auth_plugin_data,
 			const char * const auth_protocol,
 			const unsigned int charset_no,
-			const MYSQLND_SESSION_OPTIONS * const session_options,
 			const zend_ulong mysql_flags,
 			const bool silent,
 			const bool is_change_user
diff --git a/ext/mysqlnd/mysqlnd_commands.c b/ext/mysqlnd/mysqlnd_commands.c
index 52731425e18..a3aad43bbd4 100644
--- a/ext/mysqlnd/mysqlnd_commands.c
+++ b/ext/mysqlnd/mysqlnd_commands.c
@@ -623,8 +623,7 @@ MYSQLND_METHOD(mysqlnd_command, handshake)(MYSQLND_CONN_DATA * const conn, const

 	if (FAIL == mysqlnd_connect_run_authentication(conn, user, passwd, db, db_len, (size_t) passwd_len,
 												   greet_packet.authentication_plugin_data, greet_packet.auth_protocol,
-												   greet_packet.charset_no, greet_packet.server_capabilities,
-												   conn->options, mysql_flags))
+												   greet_packet.charset_no, greet_packet.server_capabilities, mysql_flags))
 	{
 		goto err;
 	}
diff --git a/ext/mysqlnd/mysqlnd_connection.c b/ext/mysqlnd/mysqlnd_connection.c
index 9065aaf579d..4a9732a0289 100644
--- a/ext/mysqlnd/mysqlnd_connection.c
+++ b/ext/mysqlnd/mysqlnd_connection.c
@@ -1386,7 +1386,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, change_user)(MYSQLND_CONN_DATA * const conn,
 	/* XXX: passwords that have \0 inside work during auth, but in this case won't work with change user */
 	ret = mysqlnd_run_authentication(conn, user, passwd, passwd_len, db, strlen(db),
 									 conn->authentication_plugin_data, conn->options->auth_protocol,
-									0 /*charset not used*/, conn->options, conn->server_capabilities, silent, TRUE/*is_change*/);
+									0 /*charset not used*/, conn->server_capabilities, silent, TRUE/*is_change*/);

 	/*
 	  Here we should close all statements. Unbuffered queries should not be a
diff --git a/ext/mysqlnd/mysqlnd_structs.h b/ext/mysqlnd/mysqlnd_structs.h
index 9cbbf4a64f1..ce102650b03 100644
--- a/ext/mysqlnd/mysqlnd_structs.h
+++ b/ext/mysqlnd/mysqlnd_structs.h
@@ -1323,7 +1323,6 @@ typedef zend_uchar * (*func_auth_plugin__get_auth_data)(struct st_mysqlnd_authen
 														size_t * auth_data_len,
 														MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd,
 														const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
-														const MYSQLND_SESSION_OPTIONS * const session_options,
 														const MYSQLND_PFC_DATA * const pfc_data, const zend_ulong mysql_flags
 														);