summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBen Fuhrmannek2021-12-14 14:21:43 +0100
committerBen Fuhrmannek2021-12-14 14:21:43 +0100
commit9cc76c5d82df5df98392c9428eb98809c97d2cc7 (patch)
treefd00ed7d4792df5c8e2bcebdc59aca8f3d280235 /src
parentc160736a503c853366c0cfb72e7a1a316cb5eef2 (diff)
get class name from execution_data
Diffstat (limited to 'src')
-rw-r--r--src/sp_disabled_functions.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/sp_disabled_functions.c b/src/sp_disabled_functions.c
index a3b3e99..4c85dec 100644
--- a/src/sp_disabled_functions.c
+++ b/src/sp_disabled_functions.c
@@ -13,20 +13,19 @@ static void should_drop_on_ret(const zval* return_value,
13 zend_execute_data* execute_data); 13 zend_execute_data* execute_data);
14 14
15char* get_complete_function_path(zend_execute_data const* const execute_data) { 15char* get_complete_function_path(zend_execute_data const* const execute_data) {
16 if (zend_is_executing() && !EG(current_execute_data)->func) { 16 if (!execute_data) {
17 return NULL; // LCOV_EXCL_LINE 17 return NULL; // LCOV_EXCL_LINE
18 } 18 }
19 if (!(execute_data->func->common.function_name)) { 19 zend_function *func = execute_data->func;
20 if (!(func->common.function_name)) {
20 return NULL; 21 return NULL;
21 } 22 }
22 23
23 char const* class_name; 24 char const* const function_name = ZSTR_VAL(func->common.function_name);
24 char const* const function_name =
25 ZSTR_VAL(execute_data->func->common.function_name);
26 char* complete_path_function = NULL; 25 char* complete_path_function = NULL;
27 26
28 class_name = get_active_class_name(NULL); 27 if ((func->type == ZEND_USER_FUNCTION || func->type == ZEND_INTERNAL_FUNCTION) && func->common.scope) {
29 if (*class_name) { 28 char const* class_name = ZSTR_VAL(func->common.scope->name);
30 const size_t len = strlen(class_name) + 2 + strlen(function_name) + 1; 29 const size_t len = strlen(class_name) + 2 + strlen(function_name) + 1;
31 complete_path_function = emalloc(len); 30 complete_path_function = emalloc(len);
32 snprintf(complete_path_function, len, "%s::%s", class_name, function_name); 31 snprintf(complete_path_function, len, "%s::%s", class_name, function_name);