From 3709e74b5e495e210ada8039ed81fafa9cbadcdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Mon, 6 Apr 2020 11:02:13 +0200 Subject: Store default parameter values of internal functions in arg info Closes GH-5353. From now on, PHP will have reflection information about default values of parameters of internal functions. Co-authored-by: Nikita Popov --- Zend/zend_inheritance.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'Zend/zend_inheritance.c') diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 10e8552b69..5f7f115af4 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -678,7 +678,14 @@ static ZEND_COLD zend_string *zend_get_function_declaration(const zend_function if (i >= required && !ZEND_ARG_IS_VARIADIC(arg_info)) { smart_str_appends(&str, " = "); - if (fptr->type == ZEND_USER_FUNCTION) { + + if (fptr->type == ZEND_INTERNAL_FUNCTION) { + if (((zend_internal_arg_info*)arg_info)->default_value) { + smart_str_appends(&str, ((zend_internal_arg_info*)arg_info)->default_value); + } else { + smart_str_appends(&str, ""); + } + } else { zend_op *precv = NULL; { uint32_t idx = i; @@ -727,8 +734,6 @@ static ZEND_COLD zend_string *zend_get_function_declaration(const zend_function zend_tmp_string_release(tmp_zv_str); } } - } else { - smart_str_appends(&str, "NULL"); } } -- cgit v1.2.1