mirror of
https://github.com/php/php-src.git
synced 2024-11-23 09:54:15 +08:00
Correctly determine arg name of USER_ARG_INFO functions
This commit is contained in:
parent
8d1a1120bf
commit
75c4e613e4
13
Zend/tests/closure_invoke_ref_warning.phpt
Normal file
13
Zend/tests/closure_invoke_ref_warning.phpt
Normal file
@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
Argument name for Closure::__invoke via call_user_func reference warning
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$test = function(&$arg) {};
|
||||
call_user_func([$test, '__invoke'], null);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Closure::__invoke(): Argument #1 ($arg) must be passed by reference, value given in %s on line %d
|
||||
|
||||
Warning: {closure}(): Argument #1 ($arg) must be passed by reference, value given in %s on line %d
|
@ -507,13 +507,10 @@ ZEND_API const char *get_function_arg_name(const zend_function *func, uint32_t a
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (func->type) {
|
||||
case ZEND_USER_FUNCTION:
|
||||
return ZSTR_VAL(func->common.arg_info[arg_num - 1].name);
|
||||
case ZEND_INTERNAL_FUNCTION:
|
||||
return ((zend_internal_arg_info*) func->common.arg_info)[arg_num - 1].name;
|
||||
default:
|
||||
return NULL;
|
||||
if (func->type == ZEND_USER_FUNCTION || (func->common.fn_flags & ZEND_ACC_USER_ARG_INFO)) {
|
||||
return ZSTR_VAL(func->common.arg_info[arg_num - 1].name);
|
||||
} else {
|
||||
return ((zend_internal_arg_info*) func->common.arg_info)[arg_num - 1].name;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
Loading…
Reference in New Issue
Block a user