Make invoke() work

This commit is contained in:
Marcus Boerger 2003-08-24 12:07:13 +00:00
parent 96d4ac7a3f
commit 669603f69d
2 changed files with 18 additions and 40 deletions

View File

@ -739,12 +739,15 @@ ZEND_METHOD(reflection_function, invoke)
{
zval *retval_ptr;
zval ***params;
zval *fname;
zval fname;
int result;
int argc = ZEND_NUM_ARGS();
zend_fcall_info fci;
reflection_object *intern;
zend_function *fptr;
METHOD_NOTSTATIC;
GET_REFLECTION_OBJECT_PTR(fptr);
params = safe_emalloc(sizeof(zval **), argc, 0);
if (zend_get_parameters_array_ex(argc, params) == FAILURE) {
@ -752,17 +755,11 @@ ZEND_METHOD(reflection_function, invoke)
RETURN_FALSE;
}
/* Invoke the function.
*
* FIXME(?): The creation of fname (NULL) is a workaround since function_name is
* _always_ checked for in zend_execute_API.c _even_ if a function pointer is given
*/
MAKE_STD_ZVAL(fname);
ZVAL_NULL(fname);
ZVAL_STRING(&fname, fptr->common.function_name, 0);
fci.size = sizeof(fci);
fci.function_table = EG(function_table);
fci.function_name = fname;
fci.function_name = &fname;
fci.symbol_table = NULL;
fci.object_pp = NULL;
fci.retval_ptr_ptr = &retval_ptr;
@ -772,7 +769,6 @@ ZEND_METHOD(reflection_function, invoke)
result = zend_call_function(&fci, NULL TSRMLS_CC);
zval_ptr_dtor(&fname);
efree(params);
if (result == FAILURE) {
@ -968,7 +964,7 @@ ZEND_METHOD(reflection_method, invoke)
zval **object_pp;
reflection_object *intern;
zend_function *mptr;
zval *fname;
zval fname;
int argc = ZEND_NUM_ARGS();
int result;
zend_fcall_info fci;
@ -1014,17 +1010,11 @@ ZEND_METHOD(reflection_method, invoke)
object_pp = params[0];
}
/* Invoke the method.
*
* FIXME(?): The creation of fname (NULL) is a workaround since function_name is
* _always_ checked for in zend_execute_API.c _even_ if a function pointer is given
*/
MAKE_STD_ZVAL(fname);
ZVAL_NULL(fname);
ZVAL_STRING(&fname, mptr->common.function_name, 0);
fci.size = sizeof(fci);
fci.function_table = EG(function_table);
fci.function_name = fname;
fci.function_name = &fname;
fci.symbol_table = NULL;
fci.object_pp = object_pp;
fci.retval_ptr_ptr = &retval_ptr;
@ -1035,7 +1025,6 @@ ZEND_METHOD(reflection_method, invoke)
result = zend_call_function(&fci, NULL TSRMLS_CC);
zval_ptr_dtor(&fname);
efree(params);
if (result == FAILURE) {

View File

@ -739,12 +739,15 @@ ZEND_METHOD(reflection_function, invoke)
{
zval *retval_ptr;
zval ***params;
zval *fname;
zval fname;
int result;
int argc = ZEND_NUM_ARGS();
zend_fcall_info fci;
reflection_object *intern;
zend_function *fptr;
METHOD_NOTSTATIC;
GET_REFLECTION_OBJECT_PTR(fptr);
params = safe_emalloc(sizeof(zval **), argc, 0);
if (zend_get_parameters_array_ex(argc, params) == FAILURE) {
@ -752,17 +755,11 @@ ZEND_METHOD(reflection_function, invoke)
RETURN_FALSE;
}
/* Invoke the function.
*
* FIXME(?): The creation of fname (NULL) is a workaround since function_name is
* _always_ checked for in zend_execute_API.c _even_ if a function pointer is given
*/
MAKE_STD_ZVAL(fname);
ZVAL_NULL(fname);
ZVAL_STRING(&fname, fptr->common.function_name, 0);
fci.size = sizeof(fci);
fci.function_table = EG(function_table);
fci.function_name = fname;
fci.function_name = &fname;
fci.symbol_table = NULL;
fci.object_pp = NULL;
fci.retval_ptr_ptr = &retval_ptr;
@ -772,7 +769,6 @@ ZEND_METHOD(reflection_function, invoke)
result = zend_call_function(&fci, NULL TSRMLS_CC);
zval_ptr_dtor(&fname);
efree(params);
if (result == FAILURE) {
@ -968,7 +964,7 @@ ZEND_METHOD(reflection_method, invoke)
zval **object_pp;
reflection_object *intern;
zend_function *mptr;
zval *fname;
zval fname;
int argc = ZEND_NUM_ARGS();
int result;
zend_fcall_info fci;
@ -1014,17 +1010,11 @@ ZEND_METHOD(reflection_method, invoke)
object_pp = params[0];
}
/* Invoke the method.
*
* FIXME(?): The creation of fname (NULL) is a workaround since function_name is
* _always_ checked for in zend_execute_API.c _even_ if a function pointer is given
*/
MAKE_STD_ZVAL(fname);
ZVAL_NULL(fname);
ZVAL_STRING(&fname, mptr->common.function_name, 0);
fci.size = sizeof(fci);
fci.function_table = EG(function_table);
fci.function_name = fname;
fci.function_name = &fname;
fci.symbol_table = NULL;
fci.object_pp = object_pp;
fci.retval_ptr_ptr = &retval_ptr;
@ -1035,7 +1025,6 @@ ZEND_METHOD(reflection_method, invoke)
result = zend_call_function(&fci, NULL TSRMLS_CC);
zval_ptr_dtor(&fname);
efree(params);
if (result == FAILURE) {