From d6264b09665c20ee73d7a1017db0730f9a7c7973 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Tue, 13 Oct 2020 20:03:00 +0200 Subject: Verify parameter names of function aliases Closes GH-6335 --- ext/mysqli/mysqli.stub.php | 17 +++++++++-------- ext/mysqli/mysqli_api.c | 7 ------- ext/mysqli/mysqli_arginfo.h | 18 +++++++++--------- ext/mysqli/mysqli_nonapi.c | 7 +++++++ ext/mysqli/tests/mysqli_fetch_field_direct.phpt | 4 ++-- 5 files changed, 27 insertions(+), 26 deletions(-) (limited to 'ext/mysqli') diff --git a/ext/mysqli/mysqli.stub.php b/ext/mysqli/mysqli.stub.php index fe82b0a3eb..4870485774 100644 --- a/ext/mysqli/mysqli.stub.php +++ b/ext/mysqli/mysqli.stub.php @@ -9,7 +9,7 @@ final class mysqli_driver class mysqli { public function __construct( - ?string $host = null, + ?string $hostname = null, ?string $username = null, ?string $password = null, ?string $database = null, @@ -56,9 +56,10 @@ class mysqli /** * @return mysqli|null|false * @alias mysqli_connect + * @no-verify */ public function connect( - ?string $host = null, + ?string $hostname = null, ?string $username = null, ?string $password = null, ?string $database = null, @@ -75,6 +76,7 @@ class mysqli /** * @return bool * @alias mysqli_debug + * @no-verify Should really be a static method */ public function debug(string $options) {} @@ -112,7 +114,6 @@ class mysqli /** * @return mysqli|false - * @alias mysqli_init_method */ public function init() {} @@ -171,7 +172,7 @@ class mysqli * @alias mysqli_real_connect */ public function real_connect( - ?string $host = null, + ?string $hostname = null, ?string $username = null, ?string $password = null, ?string $database = null, @@ -535,7 +536,7 @@ function mysqli_close(mysqli $mysql): bool {} function mysqli_commit(mysqli $mysql, int $flags = -1, ?string $name = null): bool {} function mysqli_connect( - ?string $host = null, + ?string $hostname = null, ?string $username = null, ?string $password = null, ?string $database = null, @@ -551,7 +552,7 @@ function mysqli_data_seek(mysqli_result $result, int $offset): bool {} function mysqli_dump_debug_info(mysqli $mysql): bool {} -function mysqli_debug(string $debug): bool {} +function mysqli_debug(string $options): bool {} function mysqli_errno(mysqli $mysql): int {} @@ -568,7 +569,7 @@ function mysqli_fetch_field(mysqli_result $result): object|false {} function mysqli_fetch_fields(mysqli_result $result): array {} -function mysqli_fetch_field_direct(mysqli_result $result, int $offset): object|false {} +function mysqli_fetch_field_direct(mysqli_result $result, int $index): object|false {} function mysqli_fetch_lengths(mysqli_result $result): array|false {} @@ -651,7 +652,7 @@ function mysqli_query(mysqli $mysql, string $query, int $result_mode = MYSQLI_ST function mysqli_real_connect( mysqli $mysql, - ?string $host = null, + ?string $hostname = null, ?string $username = null, ?string $password = null, ?string $database = null, diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index 9191580942..4387316b0f 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -1482,13 +1482,6 @@ PHP_FUNCTION(mysqli_init) } /* }}} */ -/* {{{ Initialize mysqli and return a resource for use with mysql_real_connect */ -PHP_FUNCTION(mysqli_init_method) -{ - php_mysqli_init(INTERNAL_FUNCTION_PARAM_PASSTHRU, TRUE); -} -/* }}} */ - /* {{{ Get the ID generated from the previous INSERT operation */ PHP_FUNCTION(mysqli_insert_id) { diff --git a/ext/mysqli/mysqli_arginfo.h b/ext/mysqli/mysqli_arginfo.h index 090e0e3ed9..73960d38eb 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: cc90d40e43462557087c123f0583e7865f281179 */ + * Stub hash: 88f90ff45ab8f9748968c39eae950d58e598b73f */ 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) @@ -38,7 +38,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mysqli_commit, 0, 1, _IS_BOOL, 0 ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_mysqli_connect, 0, 0, mysqli, MAY_BE_NULL|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, host, IS_STRING, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, hostname, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, username, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, password, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, database, IS_STRING, 1, "null") @@ -60,7 +60,7 @@ ZEND_END_ARG_INFO() #define arginfo_mysqli_dump_debug_info arginfo_mysqli_close ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mysqli_debug, 0, 1, _IS_BOOL, 0) - ZEND_ARG_TYPE_INFO(0, debug, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, options, IS_STRING, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mysqli_errno, 0, 1, IS_LONG, 0) @@ -89,7 +89,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mysqli_fetch_field_direct, 0, 2, MAY_BE_OBJECT|MAY_BE_FALSE) ZEND_ARG_OBJ_INFO(0, result, mysqli_result, 0) - ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mysqli_fetch_lengths, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE) @@ -235,7 +235,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mysqli_real_connect, 0, 1, _IS_BOOL, 0) ZEND_ARG_OBJ_INFO(0, mysql, mysqli, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, host, IS_STRING, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, hostname, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, username, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, password, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, database, IS_STRING, 1, "null") @@ -423,7 +423,7 @@ ZEND_END_ARG_INFO() #define arginfo_mysqli_set_opt arginfo_mysqli_options ZEND_BEGIN_ARG_INFO_EX(arginfo_class_mysqli___construct, 0, 0, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, host, IS_STRING, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, hostname, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, username, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, password, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, database, IS_STRING, 1, "null") @@ -511,7 +511,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_mysqli_query, 0, 0, 1) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_mysqli_real_connect, 0, 0, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, host, IS_STRING, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, hostname, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, username, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, password, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, database, IS_STRING, 1, "null") @@ -811,7 +811,7 @@ ZEND_FUNCTION(mysqli_use_result); ZEND_FUNCTION(mysqli_warning_count); ZEND_FUNCTION(mysqli_refresh); ZEND_METHOD(mysqli, __construct); -ZEND_FUNCTION(mysqli_init_method); +ZEND_METHOD(mysqli, init); ZEND_METHOD(mysqli_result, __construct); ZEND_METHOD(mysqli_result, getIterator); ZEND_METHOD(mysqli_stmt, __construct); @@ -967,7 +967,7 @@ static const zend_function_entry class_mysqli_methods[] = { #endif ZEND_ME_MAPPING(get_server_info, mysqli_get_server_info, arginfo_class_mysqli_get_server_info, ZEND_ACC_PUBLIC) ZEND_ME_MAPPING(get_warnings, mysqli_get_warnings, arginfo_class_mysqli_get_warnings, ZEND_ACC_PUBLIC) - ZEND_ME_MAPPING(init, mysqli_init_method, arginfo_class_mysqli_init, ZEND_ACC_PUBLIC) + ZEND_ME(mysqli, init, arginfo_class_mysqli_init, ZEND_ACC_PUBLIC) ZEND_ME_MAPPING(kill, mysqli_kill, arginfo_class_mysqli_kill, ZEND_ACC_PUBLIC) ZEND_ME_MAPPING(multi_query, mysqli_multi_query, arginfo_class_mysqli_multi_query, ZEND_ACC_PUBLIC) ZEND_ME_MAPPING(more_results, mysqli_more_results, arginfo_class_mysqli_more_results, ZEND_ACC_PUBLIC) diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c index c75527ff93..4ffe1c1307 100644 --- a/ext/mysqli/mysqli_nonapi.c +++ b/ext/mysqli/mysqli_nonapi.c @@ -383,6 +383,13 @@ PHP_METHOD(mysqli, __construct) mysqli_common_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, FALSE, TRUE); } +/* {{{ Initialize mysqli and return a resource for use with mysql_real_connect */ +PHP_METHOD(mysqli, init) +{ + php_mysqli_init(INTERNAL_FUNCTION_PARAM_PASSTHRU, TRUE); +} +/* }}} */ + /* {{{ Returns the numerical value of the error message from last connect command */ PHP_FUNCTION(mysqli_connect_errno) { diff --git a/ext/mysqli/tests/mysqli_fetch_field_direct.phpt b/ext/mysqli/tests/mysqli_fetch_field_direct.phpt index 4a4d240be3..6959090b78 100644 --- a/ext/mysqli/tests/mysqli_fetch_field_direct.phpt +++ b/ext/mysqli/tests/mysqli_fetch_field_direct.phpt @@ -44,7 +44,7 @@ require_once('skipifconnectfailure.inc'); require_once("clean_table.inc"); ?> --EXPECTF-- -mysqli_fetch_field_direct(): Argument #2 ($offset) must be greater than or equal to 0 +mysqli_fetch_field_direct(): Argument #2 ($index) must be greater than or equal to 0 object(stdClass)#%d (13) { ["name"]=> string(2) "ID" @@ -73,6 +73,6 @@ object(stdClass)#%d (13) { ["decimals"]=> int(%d) } -mysqli_fetch_field_direct(): Argument #2 ($offset) must be less than the number of fields for this result set +mysqli_fetch_field_direct(): Argument #2 ($index) must be less than the number of fields for this result set mysqli_result object is already closed done! -- cgit v1.2.1