Hello all,

  i am doing some unicode stuff and missng a few things and found a
few issues:

- ZVAL_STRL() is inconsistent with the rest of the ZVAL_*L().
  The former has order: zval, zstr, len, type, flags
  while the others have the order: zval, value, len, flags
  Since a zstr value is defined by the string and the type the
  order should be: zval, zstr, type, len, flags

  I discussed this with Andrei and will commit in a bit.

- zend_call_methods has no zend_u_call_method version, see patch

- parameter parsing doesn't allow to receive a string in current
  run-time setting. I will introduce a new parameter parsing option
  'x' that gets replaced by either 's' or 'u' depending on UG(unicode).
  This is pretty useful inside spl, pdo, reflection and anything else
  that deals with functions, classes, ..., see patch

Comments?

Best regards,
 Marcus
Index: Zend/zend_interfaces.c
===================================================================
RCS file: /repository/ZendEngine2/zend_interfaces.c,v
retrieving revision 1.55
diff -u -p -d -r1.55 zend_interfaces.c
--- Zend/zend_interfaces.c      28 Aug 2006 10:25:49 -0000      1.55
+++ Zend/zend_interfaces.c      19 Dec 2006 20:57:44 -0000
@@ -31,7 +31,7 @@ ZEND_API zend_class_entry *zend_ce_seria
 
 /* {{{ 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 **o
        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_ZSTR(&z_fname, function_name, function_name_type, 
function_name_len, 1);
                fci.function_table = !object_pp ? EG(function_table) : NULL;
                result = zend_call_function(&fci, NULL TSRMLS_CC);
                zval_dtor(&z_fname);
Index: Zend/zend_interfaces.h
===================================================================
RCS file: /repository/ZendEngine2/zend_interfaces.h,v
retrieving revision 1.20
diff -u -p -d -r1.20 zend_interfaces.h
--- Zend/zend_interfaces.h      21 Feb 2006 20:12:41 -0000      1.20
+++ Zend/zend_interfaces.h      19 Dec 2006 20:57:44 -0000
@@ -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 **o
 #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);
Index: Zend/zend_API.c
===================================================================
RCS file: /repository/ZendEngine2/zend_API.c,v
retrieving revision 1.417
diff -u -p -d -r1.417 zend_API.c
--- Zend/zend_API.c     1 Dec 2006 14:57:44 -0000       1.417
+++ Zend/zend_API.c     19 Dec 2006 20:57:45 -0000
@@ -333,6 +333,10 @@ static char *zend_parse_arg_impl(int arg
                spec_walk++;
        }
 
+       if (c == 'x') {
+               c = UG(unicode) ? 'u' : 's';
+       }
+
        switch (c) {
                case 'l':
                        {
@@ -867,7 +871,7 @@ static int zend_parse_va_args(int num_ar
                        case 't': case 'u':
                        case 'C': case 'h':
                        case 'U': case 'S':
-                       case 'f':
+                       case 'f': case 'x':
                                max_num_args++;
                                break;
 
-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to