diff options
author | Máté Kocsis <kocsismate@woohoolabs.com> | 2020-04-06 11:02:13 +0200 |
---|---|---|
committer | Máté Kocsis <kocsismate@woohoolabs.com> | 2020-04-08 18:37:51 +0200 |
commit | 3709e74b5e495e210ada8039ed81fafa9cbadcdb (patch) | |
tree | b7347572b1e22a2a27a45260b4f4773bf916b158 /Zend/zend_inheritance.c | |
parent | b0d8f012f95ba1f2d8dba238c93baf3afb73b78e (diff) | |
download | php-git-3709e74b5e495e210ada8039ed81fafa9cbadcdb.tar.gz |
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 <nikita.ppv@gmail.com>
Diffstat (limited to 'Zend/zend_inheritance.c')
-rw-r--r-- | Zend/zend_inheritance.c | 11 |
1 files changed, 8 insertions, 3 deletions
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, "<default>"); + } + } 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"); } } |