diff options
author | Máté Kocsis <kocsismate@woohoolabs.com> | 2020-08-16 21:49:20 +0200 |
---|---|---|
committer | Máté Kocsis <kocsismate@woohoolabs.com> | 2020-09-09 10:47:43 +0200 |
commit | 9975986b7ef849c3a8e73a48748befbfdc50e416 (patch) | |
tree | b287480ec6e0d4853fa4e1f53d3627836b74d695 /Zend/zend_execute_API.c | |
parent | c5b42be40e98f1626e2404af069af16cb6510ef3 (diff) | |
download | php-git-9975986b7ef849c3a8e73a48748befbfdc50e416.tar.gz |
Improve error messages mentioning parameters instead of arguments
Closes GH-5999
Diffstat (limited to 'Zend/zend_execute_API.c')
-rw-r--r-- | Zend/zend_execute_API.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index f1bcc74a58..030455a94e 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -443,6 +443,7 @@ ZEND_API const char *get_active_class_name(const char **space) /* {{{ */ } func = EG(current_execute_data)->func; + switch (func->type) { case ZEND_USER_FUNCTION: case ZEND_INTERNAL_FUNCTION: @@ -470,7 +471,9 @@ ZEND_API const char *get_active_function_name(void) /* {{{ */ if (!zend_is_executing()) { return NULL; } + func = EG(current_execute_data)->func; + switch (func->type) { case ZEND_USER_FUNCTION: { zend_string *function_name = func->common.function_name; @@ -491,6 +494,24 @@ ZEND_API const char *get_active_function_name(void) /* {{{ */ } /* }}} */ +ZEND_API zend_string *get_active_function_or_method_name(void) /* {{{ */ +{ + ZEND_ASSERT(zend_is_executing()); + + return get_function_or_method_name(EG(current_execute_data)->func); +} +/* }}} */ + +ZEND_API zend_string *get_function_or_method_name(const zend_function *func) /* {{{ */ +{ + if (func->common.scope) { + return zend_create_member_string(func->common.scope->name, func->common.function_name); + } + + return func->common.function_name ? zend_string_copy(func->common.function_name) : zend_string_init("main", sizeof("main") - 1, 0); +} +/* }}} */ + ZEND_API const char *get_active_function_arg_name(uint32_t arg_num) /* {{{ */ { zend_function *func; |