diff options
Diffstat (limited to 'src/callable.cpp')
-rw-r--r-- | src/callable.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/callable.cpp b/src/callable.cpp index 1ad4ed2..05545f1 100644 --- a/src/callable.cpp +++ b/src/callable.cpp @@ -19,8 +19,17 @@ namespace PhpCpp { */ void invoke_callable(INTERNAL_FUNCTION_PARAMETERS) { - std::cout << "invoke_callable" << std::endl; + // find the function name + const char *function = get_active_function_name(TSRMLS_C); + // when we registered the function name, we have hidden the pointer to the + // callable right in front of the function name - we retrieve it back + Callable *callable = *((Callable **)(function - sizeof(Callable *))); + + std::cout << "callable: " << callable << std::endl; + + + return; } /** @@ -30,7 +39,7 @@ void invoke_callable(INTERNAL_FUNCTION_PARAMETERS) void Callable::fill(zend_function_entry *entry) { // fill the members of the entity - entry->fname = _function.c_str(); + entry->fname = _name; entry->handler = invoke_callable; entry->arg_info = _argv; entry->num_args = _argc; @@ -44,8 +53,8 @@ void Callable::fill(zend_function_entry *entry) void Callable::fill(zend_internal_function_info *info) { // fill in all the members, not that the returning by reference is not used - info->_name = _function.c_str(); - info->_name_len = _function.size(); + info->_name = _name; + info->_name_len = _data.size() - sizeof(this); info->_class_name = _classname.size() ? _classname.c_str() : NULL; info->required_num_args = _required; info->_type_hint = _type; |