diff options
Diffstat (limited to 'Zend/zend_execute_API.c')
-rw-r--r-- | Zend/zend_execute_API.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index c2ea664636..7f4b1f7f33 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -297,6 +297,35 @@ void shutdown_executor(TSRMLS_D) } +/* return class name and "::" or "". */ +ZEND_API char *get_active_class_name(char **space TSRMLS_DC) +{ + if (!zend_is_executing(TSRMLS_C)) { + if (space) { + *space = ""; + } + return ""; + } + switch (EG(function_state_ptr)->function->type) { + case ZEND_USER_FUNCTION: + case ZEND_INTERNAL_FUNCTION: + { + zend_class_entry *ce = EG(function_state_ptr)->function->common.scope; + + if (space) { + *space = ce ? "::" : ""; + } + return ce ? ce->name : ""; + } + default: + if (space) { + *space = ""; + } + return ""; + } +} + + ZEND_API char *get_active_function_name(TSRMLS_D) { if (!zend_is_executing(TSRMLS_C)) { |