summaryrefslogtreecommitdiff
path: root/ext/spl/spl_engine.c
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2003-08-16 20:27:29 +0000
committerMarcus Boerger <helly@php.net>2003-08-16 20:27:29 +0000
commitc346aad91a3f5db185f7add67ddf778db59c7bbd (patch)
treea7ea62a3289d133e8828d1d631ba080a1ad31fcc /ext/spl/spl_engine.c
parent7a12eb8a2d788f9a3bb99075f78b20712c7b307d (diff)
downloadphp-git-c346aad91a3f5db185f7add67ddf778db59c7bbd.tar.gz
spl_call_method returns the zval* if used
Diffstat (limited to 'ext/spl/spl_engine.c')
-rwxr-xr-xext/spl/spl_engine.c17
1 files changed, 14 insertions, 3 deletions
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;
}
/* }}} */