diff options
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; |