]> granicus.if.org Git - php/commitdiff
Make mysqli_ssl_set() arguments nullable
authorNikita Popov <nikita.ppv@gmail.com>
Wed, 10 Feb 2021 14:31:27 +0000 (15:31 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 10 Feb 2021 14:31:27 +0000 (15:31 +0100)
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.

ext/mysqli/mysqli.stub.php
ext/mysqli/mysqli_api.c
ext/mysqli/mysqli_arginfo.h

index 9963c52763bb19fc67bf82695394ecc1bfaee36c..9326bbd9155133a90e5acf765923cf2f52bf5bd2 100644 (file)
@@ -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 {}
index d402a248176fb6ab700fbd2da72e872903612c5d..e8f25c310abaa59571b3c9390917d8beb108e670 100644 (file)
@@ -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);
index 9881a984df3cd2976f980c4b845b9f17a460a360..c9f203a559698593394170ed911a8919da93ee21 100644 (file)
@@ -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