Merge branch '74595-reflection-parameters' of https://github.com/andrewnester/php-src into PHP-7.1

* '74595-reflection-parameters' of https://github.com/andrewnester/php-src:
  Fixed #74595 - ReflectionMethod::getParameters returns incorrect number of parameters
This commit is contained in:
Xinchen Hui 2017-05-19 23:59:43 +08:00
commit 11b4f105bf
3 changed files with 63 additions and 7 deletions

View File

@ -261,6 +261,17 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mysqli_query, 0, 0, 2)
MYSQLI_ZEND_ARG_OBJ_INFO_LINK()
ZEND_ARG_INFO(0, query)
ZEND_ARG_INFO(0, resultmode)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mysqli_multi_query, 0, 0, 1)
MYSQLI_ZEND_ARG_OBJ_INFO_LINK()
ZEND_ARG_INFO(0, query)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mysqli_real_query, 0, 0, 1)
MYSQLI_ZEND_ARG_OBJ_INFO_LINK()
ZEND_ARG_INFO(0, query)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mysqli_prepare, 0, 0, 2)
@ -275,6 +286,19 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_mysqli_query, 0, 0, 1)
ZEND_ARG_INFO(0, query)
ZEND_ARG_INFO(0, resultmode)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_mysqli_prepare, 0, 0, 1)
ZEND_ARG_INFO(0, query)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_mysqli_multi_query, 0, 0, 1)
ZEND_ARG_INFO(0, query)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_mysqli_real_query, 0, 0, 1)
ZEND_ARG_INFO(0, query)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mysqli_options, 0, 0, 3)
@ -442,7 +466,7 @@ const zend_function_entry mysqli_functions[] = {
PHP_FE(mysqli_insert_id, arginfo_mysqli_only_link)
PHP_FE(mysqli_kill, arginfo_mysqli_kill)
PHP_FE(mysqli_more_results, arginfo_mysqli_only_link)
PHP_FE(mysqli_multi_query, arginfo_mysqli_query)
PHP_FE(mysqli_multi_query, arginfo_mysqli_multi_query)
PHP_FE(mysqli_next_result, arginfo_mysqli_only_link)
PHP_FE(mysqli_num_fields, arginfo_mysqli_only_result)
PHP_FE(mysqli_num_rows, arginfo_mysqli_only_result)
@ -456,7 +480,7 @@ const zend_function_entry mysqli_functions[] = {
PHP_FE(mysqli_query, arginfo_mysqli_query)
PHP_FE(mysqli_real_connect, arginfo_mysqli_real_connect)
PHP_FE(mysqli_real_escape_string, arginfo_mysqli_real_escape_string)
PHP_FE(mysqli_real_query, arginfo_mysqli_query)
PHP_FE(mysqli_real_query, arginfo_mysqli_real_query)
#if defined(MYSQLI_USE_MYSQLND)
PHP_FE(mysqli_reap_async_query, arginfo_mysqli_only_link)
#endif
@ -542,7 +566,7 @@ const zend_function_entry mysqli_link_methods[] = {
PHP_FALIAS(get_warnings, mysqli_get_warnings, arginfo_mysqli_no_params)
PHP_FALIAS(init,mysqli_init_method, arginfo_mysqli_no_params)
PHP_FALIAS(kill,mysqli_kill, arginfo_class_mysqli_kill)
PHP_FALIAS(multi_query, mysqli_multi_query, arginfo_class_mysqli_query)
PHP_FALIAS(multi_query, mysqli_multi_query, arginfo_class_mysqli_multi_query)
PHP_FALIAS(__construct, mysqli_link_construct, arginfo_mysqli_connect)
PHP_FALIAS(more_results, mysqli_more_results, arginfo_mysqli_no_params)
PHP_FALIAS(next_result, mysqli_next_result, arginfo_mysqli_no_params)
@ -551,7 +575,7 @@ const zend_function_entry mysqli_link_methods[] = {
#if defined(MYSQLI_USE_MYSQLND)
ZEND_FENTRY(poll, ZEND_FN(mysqli_poll), arginfo_mysqli_poll, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
#endif
PHP_FALIAS(prepare, mysqli_prepare, arginfo_class_mysqli_query)
PHP_FALIAS(prepare, mysqli_prepare, arginfo_class_mysqli_prepare)
PHP_FALIAS(query, mysqli_query, arginfo_class_mysqli_query)
PHP_FALIAS(real_connect, mysqli_real_connect, arginfo_class_mysqli_real_connect)
PHP_FALIAS(real_escape_string, mysqli_real_escape_string, arginfo_class_mysqli_real_escape_string)
@ -559,7 +583,7 @@ const zend_function_entry mysqli_link_methods[] = {
PHP_FALIAS(reap_async_query, mysqli_reap_async_query, arginfo_mysqli_no_params)
#endif
PHP_FALIAS(escape_string, mysqli_real_escape_string, arginfo_class_mysqli_real_escape_string)
PHP_FALIAS(real_query, mysqli_real_query, arginfo_class_mysqli_query)
PHP_FALIAS(real_query, mysqli_real_query, arginfo_class_mysqli_real_query)
PHP_FALIAS(release_savepoint, mysqli_release_savepoint, arginfo_class_mysqli_release_savepoint)
PHP_FALIAS(rollback, mysqli_rollback, arginfo_class_mysqli_rollback)
PHP_FALIAS(savepoint, mysqli_savepoint, arginfo_class_mysqli_savepoint)
@ -628,7 +652,7 @@ const zend_function_entry mysqli_stmt_methods[] = {
PHP_FALIAS(send_long_data, mysqli_stmt_send_long_data, arginfo_class_mysqli_stmt_send_long_data)
PHP_FALIAS(free_result, mysqli_stmt_free_result, arginfo_mysqli_no_params)
PHP_FALIAS(reset, mysqli_stmt_reset, arginfo_mysqli_no_params)
PHP_FALIAS(prepare, mysqli_stmt_prepare, arginfo_class_mysqli_query)
PHP_FALIAS(prepare, mysqli_stmt_prepare, arginfo_class_mysqli_prepare)
PHP_FALIAS(store_result, mysqli_stmt_store_result, arginfo_mysqli_no_params)
#if defined(MYSQLI_USE_MYSQLND)
PHP_FALIAS(get_result, mysqli_stmt_get_result, arginfo_mysqli_no_params)

View File

@ -0,0 +1,25 @@
--TEST--
Bug #74595 (ReflectionMethod::getParameters returns incorrect number of parameters)
--SKIPIF--
<?php
require_once('skipif.inc');
?>
--FILE--
<?php
$class = new ReflectionClass('mysqli');
$method = $class->getMethod('query');
var_dump($method->getParameters());
?>
--EXPECTF--
array(2) {
[0]=>
object(ReflectionParameter)#%d (1) {
["name"]=>
string(5) "query"
}
[1]=>
object(ReflectionParameter)#%d (1) {
["name"]=>
string(10) "resultmode"
}
}

View File

@ -732,7 +732,7 @@ isInternal: yes
isUserDefined: no
returnsReference: no
Modifiers: 256
Number of Parameters: 1
Number of Parameters: 2
Number of Required Parameters: 1
Inspecting parameter 'query' of method 'query'
@ -742,6 +742,13 @@ isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
Inspecting parameter 'resultmode' of method 'query'
isArray: no
allowsNull: no
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting method 'real_connect'
isFinal: no
isAbstract: no