]> granicus.if.org Git - php/commitdiff
- Implement zend_u_call_method to deal with situations where the function
authorMarcus Boerger <helly@php.net>
Tue, 19 Dec 2006 22:14:35 +0000 (22:14 +0000)
committerMarcus Boerger <helly@php.net>
Tue, 19 Dec 2006 22:14:35 +0000 (22:14 +0000)
  name type is already known

Zend/zend_interfaces.c
Zend/zend_interfaces.h

index 1230aeb997a5079081d2a63acf9902bbca40d1fc..515b6e21e6e5aece2aa9c316e9e9d55680db8fbc 100755 (executable)
@@ -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);
                        }
index f6ee0847e10dbe3ed70f98340e33fb85790e1166..6fc71560d2aa5446a5a5fd5941787a8ccdf6a83a 100755 (executable)
@@ -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);