summaryrefslogtreecommitdiff
path: root/ext/reflection/php_reflection.c
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2003-08-27 20:45:34 +0000
committerMarcus Boerger <helly@php.net>2003-08-27 20:45:34 +0000
commit7f5196953c1cd5c5bd5569772ec14b79cc7c88a7 (patch)
tree7a48b5125a66ab1567ca74c6871dcca0cd616d3b /ext/reflection/php_reflection.c
parent3c87b23aa1498617c3765cec1467d378b1820ec6 (diff)
downloadphp-git-7f5196953c1cd5c5bd5569772ec14b79cc7c88a7.tar.gz
Fix reflection_class::newInstance()
Diffstat (limited to 'ext/reflection/php_reflection.c')
-rw-r--r--ext/reflection/php_reflection.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 79024c54ce..c44496283f 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -1585,6 +1585,7 @@ ZEND_METHOD(reflection_class, newinstance)
zval ***params;
zval *fname;
zend_fcall_info fci;
+ zend_fcall_info_cache fcc;
params = safe_emalloc(sizeof(zval **), argc, 0);
if (zend_get_parameters_array_ex(argc, params) == FAILURE) {
@@ -1592,35 +1593,30 @@ ZEND_METHOD(reflection_class, newinstance)
RETURN_FALSE;
}
- /* Invoke the constructor
- *
- * 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);
-
fci.size = sizeof(fci);
fci.function_table = EG(function_table);
- fci.function_name = fname;
+ fci.function_name = NULL;
fci.symbol_table = NULL;
fci.object_pp = &return_value;
fci.retval_ptr_ptr = &retval_ptr;
fci.param_count = argc;
fci.params = params;
fci.no_separation = 1;
- /*fci.function_handler_cache = &ce->constructor;*/
- if (zend_call_function(&fci, NULL TSRMLS_CC) == FAILURE) {
+ fcc.initialized = 1;
+ fcc.function_handler = ce->constructor;
+ fcc.calling_scope = EG(scope);
+ fcc.object_pp = &return_value;
+
+ if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
efree(params);
- zval_ptr_dtor(&fname);
+ zval_ptr_dtor(&retval_ptr);
zend_error(E_WARNING, "Invokation of %s's constructor failed\n", ce->name);
RETURN_NULL();
}
if (retval_ptr) {
zval_ptr_dtor(&retval_ptr);
}
- zval_ptr_dtor(&fname);
efree(params);
}
}