From c346aad91a3f5db185f7add67ddf778db59c7bbd Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Sat, 16 Aug 2003 20:27:29 +0000 Subject: spl_call_method returns the zval* if used --- ext/spl/spl_engine.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'ext/spl/spl_engine.c') diff --git a/ext/spl/spl_engine.c b/ext/spl/spl_engine.c index 2fdf8ae9ac..48a0f1b9de 100755 --- a/ext/spl/spl_engine.c +++ b/ext/spl/spl_engine.c @@ -171,7 +171,7 @@ spl_is_a spl_implements(zend_class_entry *ce) /* }}} */ /* {{{ spl_call_method */ -int spl_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, char *function_name, int function_name_len, zval **retval_ptr, int param_count, zval* arg1, zval* arg2 TSRMLS_DC) +zval * spl_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, char *function_name, int function_name_len, zval **retval_ptr, int param_count, zval* arg1, zval* arg2 TSRMLS_DC) { int result; zend_fcall_info fci; @@ -192,8 +192,10 @@ int spl_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function ** fci.params = params; fci.no_separation = 1; fci.symbol_table = NULL; - + if (!fn_proxy && !obj_ce) { + /* no interest in caching and no information already present that is + * needed later inside zend_call_function. */ ZVAL_STRINGL(&z_fname, function_name, function_name_len, 0); result = zend_call_function(&fci, NULL TSRMLS_CC); } else { @@ -205,6 +207,7 @@ int spl_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function ** } if (!fn_proxy || !*fn_proxy) { if (zend_hash_find(&obj_ce->function_table, function_name, function_name_len+1, (void **) &fcic.function_handler) == FAILURE) { + /* error at c-level */ zend_error(E_CORE_ERROR, "Couldn't find implementation for method %s::%s\n", obj_ce->name, function_name); } if (fn_proxy) { @@ -217,11 +220,19 @@ int spl_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function ** fcic.object_pp = object_pp; result = zend_call_function(&fci, &fcic TSRMLS_CC); } + if (result == FAILURE) { + /* error at c-level */ + if (!obj_ce) { + obj_ce = Z_OBJCE_PP(object_pp); + } + zend_error(E_CORE_ERROR, "Couldn't execute method %s::%s\n", obj_ce->name, function_name); + } if (!retval_ptr && retval) { zval_dtor(retval); FREE_ZVAL(retval); + return NULL; } - return result; + return *retval_ptr; } /* }}} */ -- cgit v1.2.1