From: Marcus Boerger Date: Tue, 19 Dec 2006 22:14:35 +0000 (+0000) Subject: - Implement zend_u_call_method to deal with situations where the function X-Git-Tag: RELEASE_1_0_0RC1~630 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0caec1601a6513132407df1f754b59e17ad81021;p=php - Implement zend_u_call_method to deal with situations where the function name type is already known --- diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index 1230aeb997..515b6e21e6 100755 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -31,7 +31,7 @@ ZEND_API zend_class_entry *zend_ce_serializable; /* {{{ zend_call_method Only returns the returned zval if retval_ptr != NULL */ -ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, char *function_name, int function_name_len, zval **retval_ptr_ptr, int param_count, zval* arg1, zval* arg2 TSRMLS_DC) +ZEND_API zval* zend_u_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, int function_name_type, zstr function_name, int function_name_len, zval **retval_ptr_ptr, int param_count, zval* arg1, zval* arg2 TSRMLS_DC) { int result; zend_fcall_info fci; @@ -57,7 +57,7 @@ ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend if (!fn_proxy && !obj_ce) { /* no interest in caching and no information already present that is * needed later inside zend_call_function. */ - ZVAL_ASCII_STRINGL(&z_fname, function_name, function_name_len, 1); + ZVAL_ZSTRL(&z_fname, function_name, function_name_len, function_name_type, 1); fci.function_table = !object_pp ? EG(function_table) : NULL; result = zend_call_function(&fci, NULL TSRMLS_CC); zval_dtor(&z_fname); @@ -74,7 +74,7 @@ ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend function_table = EG(function_table); } if (!fn_proxy || !*fn_proxy) { - if (zend_hash_find(function_table, function_name, function_name_len+1, (void **) &fcic.function_handler) == FAILURE) { + if (zend_u_hash_find(function_table, function_name_type, 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 %v%s%s", obj_ce ? obj_ce->name : EMPTY_ZSTR, obj_ce ? "::" : "", function_name); } diff --git a/Zend/zend_interfaces.h b/Zend/zend_interfaces.h index f6ee0847e1..6fc71560d2 100755 --- a/Zend/zend_interfaces.h +++ b/Zend/zend_interfaces.h @@ -38,7 +38,7 @@ typedef struct _zend_user_iterator { zval *value; } zend_user_iterator; -ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, char *function_name, int function_name_len, zval **retval_ptr_ptr, int param_count, zval* arg1, zval* arg2 TSRMLS_DC); +ZEND_API zval* zend_u_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, int function_name_type, zstr function_name, int function_name_len, zval **retval_ptr_ptr, int param_count, zval* arg1, zval* arg2 TSRMLS_DC); #define zend_call_method_with_0_params(obj, obj_ce, fn_proxy, function_name, retval) \ zend_call_method(obj, obj_ce, fn_proxy, function_name, sizeof(function_name)-1, retval, 0, NULL, NULL TSRMLS_CC) @@ -49,6 +49,11 @@ ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend #define zend_call_method_with_2_params(obj, obj_ce, fn_proxy, function_name, retval, arg1, arg2) \ zend_call_method(obj, obj_ce, fn_proxy, function_name, sizeof(function_name)-1, retval, 2, arg1, arg2 TSRMLS_CC) +static inline zval* zend_call_method(zval **obj, zend_class_entry *obj_ce, zend_function **fn_proxy, char *function_name, int function_name_len, zval **retval_ptr_ptr, int param_count, zval* arg1, zval* arg2 TSRMLS_DC) +{ + return zend_u_call_method(obj, obj_ce, fn_proxy, IS_STRING, ZSTR(function_name), function_name_len, retval_ptr_ptr, param_count, arg1, arg2 TSRMLS_CC); +} + ZEND_API void zend_user_it_rewind(zend_object_iterator *_iter TSRMLS_DC); ZEND_API int zend_user_it_valid(zend_object_iterator *_iter TSRMLS_DC); ZEND_API int zend_user_it_get_current_key(zend_object_iterator *_iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC);