Skip to content

Commit 39c6aaa

Browse files
committed
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.
1 parent fd5ff37 commit 39c6aaa

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

ext/mysqli/mysqli.stub.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,11 @@ public function set_opt(int $option, $value) {}
256256
* @alias mysqli_ssl_set
257257
*/
258258
public function ssl_set(
259-
string $key,
260-
string $certificate,
261-
string $ca_certificate,
262-
string $ca_path,
263-
string $cipher_algos
259+
?string $key,
260+
?string $certificate,
261+
?string $ca_certificate,
262+
?string $ca_path,
263+
?string $cipher_algos
264264
) {}
265265

266266
/**
@@ -750,11 +750,11 @@ function mysqli_sqlstate(mysqli $mysql): string {}
750750

751751
function mysqli_ssl_set(
752752
mysqli $mysql,
753-
string $key,
754-
string $certificate,
755-
string $ca_certificate,
756-
string $ca_path,
757-
string $cipher_algos
753+
?string $key,
754+
?string $certificate,
755+
?string $ca_certificate,
756+
?string $ca_path,
757+
?string $cipher_algos
758758
): bool {}
759759

760760
function mysqli_stat(mysqli $mysql): string|false {}

ext/mysqli/mysqli_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2157,7 +2157,7 @@ PHP_FUNCTION(mysqli_ssl_set)
21572157
char *ssl_parm[5];
21582158
size_t ssl_parm_len[5], i;
21592159

2160-
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) {
2160+
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) {
21612161
RETURN_THROWS();
21622162
}
21632163
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_INITIALIZED);

ext/mysqli/mysqli_arginfo.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 5a8b778eaa9efcca7d3ad8bfdbaa31d9d07b25e8 */
2+
* Stub hash: 36c7ee22aa4c5bb5e0174031a3defcaaadde0dbd */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mysqli_affected_rows, 0, 1, MAY_BE_LONG|MAY_BE_STRING)
55
ZEND_ARG_OBJ_INFO(0, mysql, mysqli, 0)
@@ -386,11 +386,11 @@ ZEND_END_ARG_INFO()
386386

387387
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mysqli_ssl_set, 0, 6, _IS_BOOL, 0)
388388
ZEND_ARG_OBJ_INFO(0, mysql, mysqli, 0)
389-
ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
390-
ZEND_ARG_TYPE_INFO(0, certificate, IS_STRING, 0)
391-
ZEND_ARG_TYPE_INFO(0, ca_certificate, IS_STRING, 0)
392-
ZEND_ARG_TYPE_INFO(0, ca_path, IS_STRING, 0)
393-
ZEND_ARG_TYPE_INFO(0, cipher_algos, IS_STRING, 0)
389+
ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 1)
390+
ZEND_ARG_TYPE_INFO(0, certificate, IS_STRING, 1)
391+
ZEND_ARG_TYPE_INFO(0, ca_certificate, IS_STRING, 1)
392+
ZEND_ARG_TYPE_INFO(0, ca_path, IS_STRING, 1)
393+
ZEND_ARG_TYPE_INFO(0, cipher_algos, IS_STRING, 1)
394394
ZEND_END_ARG_INFO()
395395

396396
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()
549549
#define arginfo_class_mysqli_set_opt arginfo_class_mysqli_options
550550

551551
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_mysqli_ssl_set, 0, 0, 5)
552-
ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
553-
ZEND_ARG_TYPE_INFO(0, certificate, IS_STRING, 0)
554-
ZEND_ARG_TYPE_INFO(0, ca_certificate, IS_STRING, 0)
555-
ZEND_ARG_TYPE_INFO(0, ca_path, IS_STRING, 0)
556-
ZEND_ARG_TYPE_INFO(0, cipher_algos, IS_STRING, 0)
552+
ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 1)
553+
ZEND_ARG_TYPE_INFO(0, certificate, IS_STRING, 1)
554+
ZEND_ARG_TYPE_INFO(0, ca_certificate, IS_STRING, 1)
555+
ZEND_ARG_TYPE_INFO(0, ca_path, IS_STRING, 1)
556+
ZEND_ARG_TYPE_INFO(0, cipher_algos, IS_STRING, 1)
557557
ZEND_END_ARG_INFO()
558558

559559
#define arginfo_class_mysqli_stat arginfo_class_mysqli_character_set_name

0 commit comments

Comments
 (0)