Skip to content

Commit

Permalink
Make mysqli_ssl_set() arguments nullable
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nikic committed Feb 10, 2021
1 parent fd5ff37 commit 39c6aaa
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
20 changes: 10 additions & 10 deletions ext/mysqli/mysqli.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,11 @@ public function set_opt(int $option, $value) {}
* @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
) {}

/**
Expand Down Expand Up @@ -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 {}
Expand Down
2 changes: 1 addition & 1 deletion ext/mysqli/mysqli_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
22 changes: 11 additions & 11 deletions ext/mysqli/mysqli_arginfo.h
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 39c6aaa

Please sign in to comment.