summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2021-02-10 15:31:27 +0100
committerNikita Popov <nikita.ppv@gmail.com>2021-02-10 15:31:27 +0100
commit39c6aaa9ccf9ab02a28c41b6dc931f91fb19a563 (patch)
tree52737c39d483b4806ce4394d2a2ec9e7b159ee5a
parentfd5ff37db77b52b39d97c5749dcbbf4b09c10d9d (diff)
downloadphp-git-39c6aaa9ccf9ab02a28c41b6dc931f91fb19a563.tar.gz
Make mysqli_ssl_set() arguments nullable
This function internally converts zero length arguments to NULL argument -- but we should also accept them in the first place. Null arguments being accepted was actually documented, before bug #78399 adjusted the docs to match current behavior.
-rw-r--r--ext/mysqli/mysqli.stub.php20
-rw-r--r--ext/mysqli/mysqli_api.c2
-rw-r--r--ext/mysqli/mysqli_arginfo.h22
3 files changed, 22 insertions, 22 deletions
diff --git a/ext/mysqli/mysqli.stub.php b/ext/mysqli/mysqli.stub.php
index 9963c52763..9326bbd915 100644
--- a/ext/mysqli/mysqli.stub.php
+++ b/ext/mysqli/mysqli.stub.php
@@ -256,11 +256,11 @@ class mysqli
* @alias mysqli_ssl_set
*/
public function ssl_set(
- string $key,
- string $certificate,
- string $ca_certificate,
- string $ca_path,
- string $cipher_algos
+ ?string $key,
+ ?string $certificate,
+ ?string $ca_certificate,
+ ?string $ca_path,
+ ?string $cipher_algos
) {}
/**
@@ -750,11 +750,11 @@ function mysqli_sqlstate(mysqli $mysql): string {}
function mysqli_ssl_set(
mysqli $mysql,
- string $key,
- string $certificate,
- string $ca_certificate,
- string $ca_path,
- string $cipher_algos
+ ?string $key,
+ ?string $certificate,
+ ?string $ca_certificate,
+ ?string $ca_path,
+ ?string $cipher_algos
): bool {}
function mysqli_stat(mysqli $mysql): string|false {}
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c
index d402a24817..e8f25c310a 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.c
@@ -2157,7 +2157,7 @@ PHP_FUNCTION(mysqli_ssl_set)
char *ssl_parm[5];
size_t ssl_parm_len[5], i;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Osssss", &mysql_link, mysqli_link_class_entry, &ssl_parm[0], &ssl_parm_len[0], &ssl_parm[1], &ssl_parm_len[1], &ssl_parm[2], &ssl_parm_len[2], &ssl_parm[3], &ssl_parm_len[3], &ssl_parm[4], &ssl_parm_len[4]) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os!s!s!s!s!", &mysql_link, mysqli_link_class_entry, &ssl_parm[0], &ssl_parm_len[0], &ssl_parm[1], &ssl_parm_len[1], &ssl_parm[2], &ssl_parm_len[2], &ssl_parm[3], &ssl_parm_len[3], &ssl_parm[4], &ssl_parm_len[4]) == FAILURE) {
RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_INITIALIZED);
diff --git a/ext/mysqli/mysqli_arginfo.h b/ext/mysqli/mysqli_arginfo.h
index 9881a984df..c9f203a559 100644
--- a/ext/mysqli/mysqli_arginfo.h
+++ b/ext/mysqli/mysqli_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 5a8b778eaa9efcca7d3ad8bfdbaa31d9d07b25e8 */
+ * Stub hash: 36c7ee22aa4c5bb5e0174031a3defcaaadde0dbd */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mysqli_affected_rows, 0, 1, MAY_BE_LONG|MAY_BE_STRING)
ZEND_ARG_OBJ_INFO(0, mysql, mysqli, 0)
@@ -386,11 +386,11 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mysqli_ssl_set, 0, 6, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, mysql, mysqli, 0)
- ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
- ZEND_ARG_TYPE_INFO(0, certificate, IS_STRING, 0)
- ZEND_ARG_TYPE_INFO(0, ca_certificate, IS_STRING, 0)
- ZEND_ARG_TYPE_INFO(0, ca_path, IS_STRING, 0)
- ZEND_ARG_TYPE_INFO(0, cipher_algos, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, certificate, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, ca_certificate, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, ca_path, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, cipher_algos, IS_STRING, 1)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mysqli_stat, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
@@ -549,11 +549,11 @@ ZEND_END_ARG_INFO()
#define arginfo_class_mysqli_set_opt arginfo_class_mysqli_options
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_mysqli_ssl_set, 0, 0, 5)
- ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
- ZEND_ARG_TYPE_INFO(0, certificate, IS_STRING, 0)
- ZEND_ARG_TYPE_INFO(0, ca_certificate, IS_STRING, 0)
- ZEND_ARG_TYPE_INFO(0, ca_path, IS_STRING, 0)
- ZEND_ARG_TYPE_INFO(0, cipher_algos, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, certificate, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, ca_certificate, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, ca_path, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, cipher_algos, IS_STRING, 1)
ZEND_END_ARG_INFO()
#define arginfo_class_mysqli_stat arginfo_class_mysqli_character_set_name