com php-src: Fix arg/func info: ext/mysqli/mysqli.stub.php ext/mysqli/mysqli_api.c ext/mysqli/mysqli_arginfo.h ext/opcache/Optimizer/zend_func_info.c
ext/opcache/t ests/func_info.phpt

From: Date: Tue, 21 Jul 2020 13:00:33 +0000
Subject: com php-src: Fix arg/func info: ext/mysqli/mysqli.stub.php ext/mysqli/mysqli_api.c ext/mysqli/mysqli_arginfo.h ext/opcache/Optimizer/zend_func_info.c
ext/opcache/t ests/func_info.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-112294@lists.php.net to get a copy of this message
Commit: f7f557926e7432334253feafa7647790e1a387ab Author: Nikita Popov <nikita.ppv@gmail.com> Tue, 21 Jul 2020 14:58:35 +0200 Parents: 5770b6672228dff9a5f320ce9938e7b196bb03e8 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f7f557926e7432334253feafa7647790e1a387ab Log: Fix arg/func info * mysqli_get_server_info() cannot return null. The underlying API is infallible. * mysqli_select_db() func info is redundant. * mb_detect_order() can only return array|true, not array|false. Also make the func_info.phpt test that is supposed to catch these kinds of issues actually work. Changed paths: M ext/mysqli/mysqli.stub.php M ext/mysqli/mysqli_api.c M ext/mysqli/mysqli_arginfo.h M ext/opcache/Optimizer/zend_func_info.c M ext/opcache/tests/func_info.phpt Diff: diff --git a/ext/mysqli/mysqli.stub.php b/ext/mysqli/mysqli.stub.php index e8af0485dc..5e73f34fa0 100644 --- a/ext/mysqli/mysqli.stub.php +++ b/ext/mysqli/mysqli.stub.php @@ -609,7 +609,7 @@ function mysqli_get_host_info(mysqli $mysqli_link): string {} function mysqli_get_proto_info(mysqli $mysqli_link): int {} -function mysqli_get_server_info(mysqli $mysqli_link): ?string {} +function mysqli_get_server_info(mysqli $mysqli_link): string {} function mysqli_get_server_version(mysqli $mysqli_link): int {} diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index 8dbbd45c8e..76f336c004 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -1403,17 +1403,13 @@ PHP_FUNCTION(mysqli_get_server_info) { MY_MYSQL *mysql; zval *mysql_link = NULL; - const char *info; if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { RETURN_THROWS(); } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); - info = mysql_get_server_info(mysql->mysql); - if (info) { - RETURN_STRING(info); - } + RETURN_STRING(mysql_get_server_info(mysql->mysql)); } /* }}} */ diff --git a/ext/mysqli/mysqli_arginfo.h b/ext/mysqli/mysqli_arginfo.h index cacc5d1d81..3b2b995dc5 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: 49567a0e831c0a484aaf2c2d213ad24109f2639b */ + * Stub hash: cde1bbb449c6adae7a99c7df3e9d290d501e18be */ 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_link, mysqli, 0) @@ -162,9 +162,7 @@ ZEND_END_ARG_INFO() #define arginfo_mysqli_get_proto_info arginfo_mysqli_field_count -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mysqli_get_server_info, 0, 1, IS_STRING, 1) - ZEND_ARG_OBJ_INFO(0, mysqli_link, mysqli, 0) -ZEND_END_ARG_INFO() +#define arginfo_mysqli_get_server_info arginfo_mysqli_get_host_info #define arginfo_mysqli_get_server_version arginfo_mysqli_field_count @@ -175,7 +173,9 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_mysqli_init, 0, 0, mysqli, MAY_BE_FALSE) ZEND_END_ARG_INFO() -#define arginfo_mysqli_info arginfo_mysqli_get_server_info +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mysqli_info, 0, 1, IS_STRING, 1) + ZEND_ARG_OBJ_INFO(0, mysqli_link, mysqli, 0) +ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mysqli_insert_id, 0, 1, MAY_BE_LONG|MAY_BE_STRING) ZEND_ARG_OBJ_INFO(0, mysqli_link, mysqli, 0) @@ -377,7 +377,7 @@ ZEND_END_ARG_INFO() #define arginfo_mysqli_stmt_sqlstate arginfo_mysqli_stmt_error -#define arginfo_mysqli_sqlstate arginfo_mysqli_get_server_info +#define arginfo_mysqli_sqlstate arginfo_mysqli_info ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mysqli_ssl_set, 0, 6, _IS_BOOL, 0) ZEND_ARG_OBJ_INFO(0, mysql_link, mysqli, 0) diff --git a/ext/opcache/Optimizer/zend_func_info.c b/ext/opcache/Optimizer/zend_func_info.c index 1affffbee6..94a161a136 100644 --- a/ext/opcache/Optimizer/zend_func_info.c +++ b/ext/opcache/Optimizer/zend_func_info.c @@ -489,7 +489,6 @@ static const func_info_t func_infos[] = { F0("mysqli_stmt_data_seek", MAY_BE_NULL | MAY_BE_FALSE), F1("mysqli_stmt_insert_id", MAY_BE_LONG | MAY_BE_STRING), F1("mysqli_stmt_num_rows", MAY_BE_LONG | MAY_BE_STRING), - F0("mysqli_select_db", MAY_BE_FALSE | MAY_BE_TRUE), F1("mysqli_sqlstate", MAY_BE_NULL | MAY_BE_STRING), F0("mysqli_ssl_set", MAY_BE_TRUE), F1("mysqli_stat", MAY_BE_FALSE | MAY_BE_STRING), @@ -523,7 +522,7 @@ static const func_info_t func_infos[] = { F1("mb_internal_encoding", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING), F1("mb_http_input", MAY_BE_FALSE | MAY_BE_STRING| MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), F1("mb_http_output", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING), - F1("mb_detect_order", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), + F1("mb_detect_order", MAY_BE_TRUE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), F1("mb_substitute_character", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_LONG | MAY_BE_STRING), F1("mb_output_handler", MAY_BE_STRING), F1("mb_preferred_mime_name", MAY_BE_FALSE | MAY_BE_STRING), diff --git a/ext/opcache/tests/func_info.phpt b/ext/opcache/tests/func_info.phpt index 71843a86a2..f5e4b5b182 100644 --- a/ext/opcache/tests/func_info.phpt +++ b/ext/opcache/tests/func_info.phpt @@ -13,7 +13,10 @@ $contents = "<?php\n"; $contents .= "function test() {\n"; foreach (get_defined_functions()["internal"] as $function) { - $contents .= " {$function}();\n"; + if (in_array($function, ["extract", "compact", "get_defined_vars"])) { + continue; + } + $contents .= " \$result = {$function}();\n"; } $contents .= "}\n";

« previous php.cvs (#112294) next »