]> granicus.if.org Git - php/commitdiff
Portable unicode string API:
authorDmitry Stogov <dmitry@php.net>
Tue, 21 Feb 2006 20:12:43 +0000 (20:12 +0000)
committerDmitry Stogov <dmitry@php.net>
Tue, 21 Feb 2006 20:12:43 +0000 (20:12 +0000)
  - use the same type (int) for zval.value.usr.len and zval.value.str.len
  - use union "zstr" as char*/UChar* mixture instead of void*
  - Z_UNISTR() and Z_UNILEN() no longer check for Z_TYPE()
  - nuke int32_t from ZE (not finisned)

76 files changed:
Zend/zend.c
Zend/zend.h
Zend/zend_API.c
Zend/zend_API.h
Zend/zend_alloc.c
Zend/zend_alloc.h
Zend/zend_builtin_functions.c
Zend/zend_compile.c
Zend/zend_compile.h
Zend/zend_constants.c
Zend/zend_constants.h
Zend/zend_exceptions.c
Zend/zend_execute.c
Zend/zend_execute.h
Zend/zend_execute_API.c
Zend/zend_hash.c
Zend/zend_hash.h
Zend/zend_highlight.c
Zend/zend_ini.c
Zend/zend_interfaces.c
Zend/zend_interfaces.h
Zend/zend_iterators.c
Zend/zend_iterators.h
Zend/zend_language_scanner.l
Zend/zend_list.c
Zend/zend_object_handlers.c
Zend/zend_object_handlers.h
Zend/zend_objects.c
Zend/zend_opcode.c
Zend/zend_operators.c
Zend/zend_operators.h
Zend/zend_strtol.c
Zend/zend_unicode.c
Zend/zend_unicode.h
Zend/zend_vm_def.h
Zend/zend_vm_execute.h
ext/dom/dom_iterators.c
ext/dom/php_dom.c
ext/hash/hash.c
ext/libxml/libxml.c
ext/mysql/php_mysql.c
ext/openssl/openssl.c
ext/pcre/php_pcre.c
ext/pdo/pdo_dbh.c
ext/pdo/pdo_stmt.c
ext/reflection/php_reflection.c
ext/session/php_session.h
ext/session/session.c
ext/simplexml/simplexml.c
ext/soap/php_encoding.c
ext/soap/soap.c
ext/spl/php_spl.c
ext/spl/spl_array.c
ext/spl/spl_directory.c
ext/spl/spl_engine.h
ext/spl/spl_iterators.c
ext/spl/spl_iterators.h
ext/sqlite/sqlite.c
ext/standard/array.c
ext/standard/basic_functions.c
ext/standard/http.c
ext/standard/incomplete_class.c
ext/standard/info.c
ext/standard/php_incomplete_class.h
ext/standard/proc_open.c
ext/standard/streamsfuncs.c
ext/standard/string.c
ext/standard/type.c
ext/standard/user_filters.c
ext/standard/var.c
main/main.c
main/output.c
main/php_variables.c
main/rfc1867.c
main/streams/streams.c
sapi/cli/php_cli.c

index 13dce09ff8eece8858bb650018ca1dabf1a50723..9701e4533d3ab7eab7a8422487550f70ab5a6090 100644 (file)
@@ -244,7 +244,7 @@ static uint zend_version_info_length;
 static void print_hash(HashTable *ht, int indent, zend_bool is_object TSRMLS_DC)
 {
        zval **tmp;
-       char *string_key;
+       zstr string_key;
        HashPosition iterator;
        ulong num_key;
        uint str_len;
@@ -272,12 +272,12 @@ static void print_hash(HashTable *ht, int indent, zend_bool is_object TSRMLS_DC)
                                ztype = IS_UNICODE;
 str_type:
                                if (is_object) {
-                                       char *prop_name, *class_name;
+                                       zstr prop_name, class_name;
 
                                        zend_u_unmangle_property_name(ztype, string_key, &class_name, &prop_name);
 
-                                       if (class_name) {
-                                               if (class_name[0]=='*') {
+                                       if (class_name.v) {
+                                               if (class_name.s[0]=='*') {
                                                        zend_printf("%R:protected", ztype, prop_name);
                                                } else {
                                                        zend_printf("%R:%v:private", ztype, prop_name, class_name);
@@ -308,7 +308,7 @@ str_type:
 static void print_flat_hash(HashTable *ht TSRMLS_DC)
 {
        zval **tmp;
-       char *string_key;
+       zstr string_key;
        HashPosition iterator;
        ulong num_key;
        uint str_len;
@@ -322,10 +322,10 @@ static void print_flat_hash(HashTable *ht TSRMLS_DC)
                ZEND_PUTS("[");
                switch (zend_hash_get_current_key_ex(ht, &string_key, &str_len, &num_key, 0, &iterator)) {
                        case HASH_KEY_IS_STRING:
-                               ZEND_PUTS(string_key);
+                               ZEND_PUTS(string_key.s);
                                break;
                        case HASH_KEY_IS_UNICODE:
-                               zend_printf("%r", string_key);
+                               zend_printf("%r", string_key.u);
                                break;
                        case HASH_KEY_IS_LONG:
                                zend_printf("%ld", num_key);
@@ -527,19 +527,19 @@ ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC)
                case IS_OBJECT:
                {
                        HashTable *properties = NULL;
-                       char *class_name = NULL;
+                       zstr class_name = (zstr)NULL;
                        zend_uint clen;
 
                        if (Z_OBJ_HANDLER_P(expr, get_class_name)) {
                                Z_OBJ_HANDLER_P(expr, get_class_name)(expr, &class_name, &clen, 0 TSRMLS_CC);
                        }
-                       if (class_name) {
-                               zend_printf("%v Object (", class_name);
+                       if (class_name.v) {
+                               zend_printf("%v Object (", class_name.v);
                        } else {
                                zend_printf("%s Object (", "Unknown Class");
                        }
-                       if (class_name) {
-                               efree(class_name);
+                       if (class_name.v) {
+                               efree(class_name.v);
                        }
                        if (Z_OBJ_HANDLER_P(expr, get_properties)) {
                                properties = Z_OBJPROP_P(expr);
@@ -584,19 +584,19 @@ ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int
                case IS_OBJECT:
                        {
                                HashTable *properties = NULL;
-                               char *class_name = NULL;
+                               zstr class_name = (zstr)NULL;
                                zend_uint clen;
 
                                if (Z_OBJ_HANDLER_P(expr, get_class_name)) {
                                        Z_OBJ_HANDLER_P(expr, get_class_name)(expr, &class_name, &clen, 0 TSRMLS_CC);
                                }
-                               if (class_name) {
-                                       zend_printf("%v Object\n", class_name);
+                               if (class_name.v) {
+                                       zend_printf("%v Object\n", class_name.v);
                                } else {
                                        zend_printf("%s Object\n", "Unknown Class");
                                }
-                               if (class_name) {
-                                       efree(class_name);
+                               if (class_name.v) {
+                                       efree(class_name.v);
                                }
                                if (Z_OBJ_HANDLER_P(expr, get_properties)) {
                                        properties = Z_OBJPROP_P(expr);
@@ -634,7 +634,7 @@ static void register_standard_class(TSRMLS_D)
 
        zend_standard_class_def->type = ZEND_INTERNAL_CLASS;
        zend_standard_class_def->name_length = sizeof("stdClass") - 1;
-       zend_standard_class_def->name = zend_strndup("stdClass", zend_standard_class_def->name_length);
+       zend_standard_class_def->name.s = zend_strndup("stdClass", zend_standard_class_def->name_length);
        zend_initialize_class_data(zend_standard_class_def, 1 TSRMLS_CC);
 
        zend_hash_add(CG(class_table), "stdclass", sizeof("stdclass"), &zend_standard_class_def, sizeof(zend_class_entry *), NULL);
@@ -672,19 +672,19 @@ static void zend_u_function_dtor(zend_function *function)
 
        destroy_zend_function(function TSRMLS_CC);
        if (function->type == ZEND_INTERNAL_FUNCTION) {
-               if (function->common.function_name) {
-                       free(function->common.function_name);
+               if (function->common.function_name.v) {
+                       free(function->common.function_name.v);
                }
                if (function->common.arg_info) {
                        int n = function->common.num_args;
 
                        while (n > 0) {
                                --n;
-                               if (function->common.arg_info[n].name) {
-                                       free(function->common.arg_info[n].name);
+                               if (function->common.arg_info[n].name.v) {
+                                       free(function->common.arg_info[n].name.v);
                                }
-                               if (function->common.arg_info[n].class_name) {
-                                       free(function->common.arg_info[n].class_name);
+                               if (function->common.arg_info[n].class_name.v) {
+                                       free(function->common.arg_info[n].class_name.v);
                                }
                        }
                        free(function->common.arg_info);
@@ -699,18 +699,18 @@ static void free_u_zend_constant(zend_constant *c)
        } else {
                zval_internal_dtor(&c->value);
        }
-       free(c->name);
+       free(c->name.v);
 }
 
 static void function_to_unicode(zend_function *func TSRMLS_DC)
 {
-       if (func->common.function_name) {
+       if (func->common.function_name.s) {
                UChar *uname;
-               int   len = strlen(func->common.function_name)+1;
+               int   len = strlen(func->common.function_name.s)+1;
 
                uname = malloc(UBYTES(len));
-               u_charsToUChars(func->common.function_name, uname, len);
-               func->common.function_name = (char*)uname;
+               u_charsToUChars(func->common.function_name.s, uname, len);
+               func->common.function_name.u = uname;
        }
        if (func->common.arg_info) {
                zend_arg_info *args;
@@ -720,15 +720,15 @@ static void function_to_unicode(zend_function *func TSRMLS_DC)
                memcpy(args, func->common.arg_info, (n + 1) * sizeof(zend_arg_info));
                while (n > 0) {
                  --n;
-                 if (args[n].name) {
+                 if (args[n].name.s) {
                                UChar *uname = malloc(UBYTES(args[n].name_len));
-                               u_charsToUChars(args[n].name, uname, args[n].name_len);
-                               args[n].name = (char*)uname;
+                               u_charsToUChars(args[n].name.s, uname, args[n].name_len);
+                               args[n].name.u = uname;
                  }
-                 if (args[n].class_name) {
+                 if (args[n].class_name.s) {
                                UChar *uname = malloc(UBYTES(args[n].class_name_len));
-                               u_charsToUChars(args[n].class_name, uname, args[n].class_name_len);
-                               args[n].class_name = (char*)uname;
+                               u_charsToUChars(args[n].class_name.s, uname, args[n].class_name_len);
+                               args[n].class_name.u = uname;
                  }
                }
                func->common.arg_info = args;
@@ -737,13 +737,13 @@ static void function_to_unicode(zend_function *func TSRMLS_DC)
 
 static void property_info_to_unicode(zend_property_info *info TSRMLS_DC)
 {
-       if (info->name) {
+       if (info->name.s) {
                UChar *uname;
 
                uname = malloc(UBYTES(info->name_length+1));
-               u_charsToUChars(info->name, uname, info->name_length+1);
-               free(info->name);
-               info->name = (char*)uname;
+               u_charsToUChars(info->name.s, uname, info->name_length+1);
+               free(info->name.s);
+               info->name.u = uname;
                info->h = zend_u_get_hash_value(IS_UNICODE, info->name, info->name_length+1);
        }
 }
@@ -757,11 +757,11 @@ static void const_to_unicode(zend_constant *c)
 {
        UChar *uname;
 
-       if (c->name) {
+       if (c->name.s) {
                uname = malloc(UBYTES(c->name_len));
-               u_charsToUChars(c->name, uname, c->name_len);
-               free(c->name);
-               c->name = (char*)uname;
+               u_charsToUChars(c->name.s, uname, c->name_len);
+               free(c->name.s);
+               c->name.u = uname;
        }
        if (Z_TYPE(c->value) == IS_STRING || Z_TYPE(c->value) == IS_CONSTANT) {
                UChar *ustr;
@@ -776,12 +776,12 @@ static void const_to_unicode(zend_constant *c)
 static void class_to_unicode(zend_class_entry **ce TSRMLS_DC)
 {
        /* Convert name to unicode */
-       if ((*ce)->name) {
+       if ((*ce)->name.s) {
                UChar *uname = malloc(UBYTES((*ce)->name_length+1));
 
-               u_charsToUChars((*ce)->name, uname, (*ce)->name_length+1);
-               free((*ce)->name);
-               (*ce)->name = (char*)uname;
+               u_charsToUChars((*ce)->name.s, uname, (*ce)->name_length+1);
+               free((*ce)->name.s);
+               (*ce)->name.u = uname;
        }
 
        zend_hash_to_unicode(&(*ce)->function_table, (apply_func_t)function_to_unicode TSRMLS_CC);
@@ -1564,7 +1564,8 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co
                        if (EG(exception)) {
                                char ex_class_name[128];
                                if (Z_TYPE_P(EG(exception)) == IS_OBJECT) {
-                                       strncpy(ex_class_name, Z_OBJ_CLASS_NAME_P(EG(exception)), 127);
+                                       /* CHECK ME: why strings only */
+                                       strncpy(ex_class_name, Z_OBJ_CLASS_NAME_P(EG(exception)).s, 127);
                                        ex_class_name[127] = '\0';
                                } else {
                                        strcpy(ex_class_name, "Unknown Exception");
index de279083e6e2fe6e59d42835dce04f3f2eb5410f..e3377c58c006c952eb55f934f8ae30ce0deb12ed 100644 (file)
@@ -240,6 +240,12 @@ char *alloca ();
 #define LONG_MIN (- LONG_MAX - 1)
 #endif
 
+typedef union _zstr {
+       char  *s;
+       UChar *u;
+       void  *v;
+} zstr;
+
 #define EMPTY_STR ((UChar*)"\0\0")
 
 #undef SUCCESS
@@ -294,7 +300,7 @@ typedef union _zvalue_value {
        } str;
        struct {                    /* Unicode string type */
                UChar *val;
-               int32_t len;
+               int len;
        } ustr;
        HashTable *ht;                          /* hash table value */
        zend_object_value obj;
@@ -326,7 +332,7 @@ typedef struct _zend_unserialize_data zend_unserialize_data;
 
 struct _zend_class_entry {
        char type;
-       char *name;
+       zstr name;
        zend_uint name_length;
        struct _zend_class_entry *parent;
        int refcount;
@@ -663,8 +669,8 @@ END_EXTERN_C()
 
 #define ZEND_U_EQUAL(type, ustr, ulen, str, slen) \
        ((type == IS_STRING)? \
-         (!memcmp((ustr),(str),(slen))): \
-         (!zend_cmp_unicode_and_literal(((UChar*)(ustr)), ulen, str, slen)))
+         (!memcmp((ustr).s,(str),(slen))): \
+         (!zend_cmp_unicode_and_literal((ustr).u, ulen, str, slen)))
 
 
 #endif /* ZEND_H */
index 171df36ac2ff846718db7a0336f65436ccf796a3..125821c55005a975369054717f40e90420c52e57 100644 (file)
@@ -156,7 +156,7 @@ ZEND_API int _zend_get_parameters_array_ex(int param_count, zval ***argument_arr
 
                if (EG(ze1_compatibility_mode) && Z_TYPE_PP(value) == IS_OBJECT) {
                        zval *value_ptr;
-                       char *class_name;
+                       zstr class_name;
                        zend_uint class_name_len;
                        int dup;
 
@@ -165,9 +165,9 @@ ZEND_API int _zend_get_parameters_array_ex(int param_count, zval ***argument_arr
                        ALLOC_ZVAL(value_ptr);
                        *value_ptr = **value;
                        INIT_PZVAL(value_ptr);
-                       zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name);
+                       zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name.v);
                        if(!dup) {
-                               efree(class_name);
+                               efree(class_name.v);
                        }
                        Z_OBJVAL_P(value_ptr) = Z_OBJ_HANDLER_PP(value, clone_obj)(*value TSRMLS_CC);
                        zval_ptr_dtor(value);
@@ -206,7 +206,7 @@ ZEND_API int zend_copy_parameters_array(int param_count, zval *argument_array TS
 ZEND_API void zend_wrong_param_count(TSRMLS_D)
 {
        char *space;
-       char *class_name = get_active_class_name(&space TSRMLS_CC);
+       zstr class_name = get_active_class_name(&space TSRMLS_CC);
 
        zend_error(E_WARNING, "Wrong parameter count for %v%s%v()", class_name, space, get_active_function_name(TSRMLS_C));
 }
@@ -260,7 +260,7 @@ ZEND_API zend_class_entry *zend_get_class_entry(zval *zobject TSRMLS_DC)
 }
 
 /* returns 1 if you need to copy result, 0 if it's already a copy */
-ZEND_API int zend_get_object_classname(zval *object, char **class_name, zend_uint *class_name_len TSRMLS_DC)
+ZEND_API int zend_get_object_classname(zval *object, zstr *class_name, zend_uint *class_name_len TSRMLS_DC)
 {
        if (Z_OBJ_HT_P(object)->get_class_name == NULL ||
                Z_OBJ_HT_P(object)->get_class_name(object, class_name, class_name_len, 0 TSRMLS_CC) != SUCCESS) {
@@ -440,7 +440,7 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **sp
                case 'u':
                        {
                                UChar **p = va_arg(*va, UChar **);
-                               int32_t *pl = va_arg(*va, int32_t *);
+                               int *pl = va_arg(*va, int *);
                                switch (Z_TYPE_PP(arg)) {
                                        case IS_NULL:
                                                if (return_null) {
@@ -485,7 +485,7 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **sp
                        if (T_arg_type != -1)
                        {
                                void **p = va_arg(*va, void **);
-                               int32_t *pl = va_arg(*va, int32_t *);
+                               int *pl = va_arg(*va, int *);
                                zend_uchar *type = va_arg(*va, zend_uchar *);
                                switch (Z_TYPE_PP(arg)) {
                                        case IS_NULL:
@@ -511,7 +511,7 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **sp
                                                } else {
                                                        if (Z_TYPE_PP(arg) == IS_UNICODE) {
                                                                char *space;
-                                                               char *class_name = get_active_class_name(&space TSRMLS_CC);
+                                                               zstr class_name = get_active_class_name(&space TSRMLS_CC);
                                                                zend_error(E_WARNING, "%v%s%v() does not allow mixing binary and Unicode parameters",
                                                                                   class_name, space, get_active_function_name(TSRMLS_C));
                                                                return "";
@@ -523,7 +523,8 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **sp
                                                if (Z_OBJ_HANDLER_PP(arg, cast_object)) {
                                                        SEPARATE_ZVAL_IF_NOT_REF(arg);
                                                        if (Z_OBJ_HANDLER_PP(arg, cast_object)(*arg, *arg, T_arg_type TSRMLS_CC) == SUCCESS) {
-                                                               *(char**)p = Z_UNIVAL_PP(arg);
+                                                               /* FIXME: Unicode support??? */
+                                                               *(char**)p = Z_STRVAL_PP(arg);
                                                                *pl = Z_UNILEN_PP(arg);
                                                                *type = Z_TYPE_PP(arg);
                                                                RETURN_AS_UNICODE(arg, p, pl, type);
@@ -545,7 +546,7 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **sp
                case 't':
                        {
                                void **p = va_arg(*va, void **);
-                               int32_t *pl = va_arg(*va, int32_t *);
+                               int *pl = va_arg(*va, int *);
                                zend_uchar *type = va_arg(*va, zend_uchar *);
                                switch (Z_TYPE_PP(arg)) {
                                        case IS_NULL:
@@ -696,7 +697,8 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **sp
                                        if (Z_TYPE_PP(arg) == IS_NULL && return_null) {
                                                *p = NULL;
                                        } else {
-                                               return ce ? ce->name : "object";
+                                               /* FIXME: Unicode support??? */
+                                               return ce ? ce->name.s : "object";
                                        }
                                }
                        }
@@ -707,12 +709,8 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **sp
                                zend_class_entry **lookup, **pce = va_arg(*va, zend_class_entry **);
                                zend_class_entry *ce_base = *pce;
 
-                               if (UG(unicode)) {
-                                       convert_to_unicode_ex(arg);
-                               } else {
-                                       convert_to_string_ex(arg);
-                               }
-                               if (zend_u_lookup_class(Z_TYPE_PP(arg), Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &lookup TSRMLS_CC) == FAILURE) {
+                               convert_to_text_ex(arg);
+                               if (zend_u_lookup_class(Z_TYPE_PP(arg), Z_UNIVAL_PP(arg), Z_UNILEN_PP(arg), &lookup TSRMLS_CC) == FAILURE) {
                                        *pce = NULL;
                                } else {
                                        *pce = *lookup;
@@ -720,7 +718,7 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **sp
                                if (ce_base) {
                                        if ((!*pce || !instanceof_function(*pce, ce_base TSRMLS_CC)) && !return_null) {
                                                char *space;
-                                               char *class_name = get_active_class_name(&space TSRMLS_CC);
+                                               zstr class_name = get_active_class_name(&space TSRMLS_CC);
                                                zend_error(E_WARNING, "%v%s%v() expects parameter %d to be a class name derived from %v, '%v' given",
                                                           class_name, space, get_active_function_name(TSRMLS_C),
                                                           arg_num, ce_base->name, Z_STRVAL_PP(arg));
@@ -730,7 +728,7 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **sp
                                }
                                if (!*pce && !return_null) {
                                        char *space;
-                                       char *class_name = get_active_class_name(&space TSRMLS_CC);
+                                       zstr class_name = get_active_class_name(&space TSRMLS_CC);
                                        zend_error(E_WARNING, "%v%s%v() expects parameter %d to be a valid class name, '%v' given",
                                                   class_name, space, get_active_function_name(TSRMLS_C),
                                                   arg_num, Z_STRVAL_PP(arg));
@@ -778,7 +776,7 @@ static int zend_parse_arg(int arg_num, zval **arg, va_list *va, char **spec, int
        if (expected_type) {
                if (!quiet && *expected_type) {
                        char *space;
-                       char *class_name = get_active_class_name(&space TSRMLS_CC);
+                       zstr class_name = get_active_class_name(&space TSRMLS_CC);
 
                        zend_error(E_WARNING, "%v%s%v() expects parameter %d to be %s, %s given",
                                        class_name, space, get_active_function_name(TSRMLS_C), arg_num, expected_type,
@@ -832,7 +830,7 @@ static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int fl
                        default:
                                if (!quiet) {
                                        char *space;
-                                       char *class_name = get_active_class_name(&space TSRMLS_CC);
+                                       zstr class_name = get_active_class_name(&space TSRMLS_CC);
                                        zend_error(E_WARNING, "%v%s%v(): bad type specifier while parsing parameters",
                                                        class_name, space,
                                                        get_active_function_name(TSRMLS_C));
@@ -848,7 +846,7 @@ static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int fl
        if (num_args < min_num_args || num_args > max_num_args) {
                if (!quiet) {
                        char *space;
-                       char *class_name = get_active_class_name(&space TSRMLS_CC);
+                       zstr class_name = get_active_class_name(&space TSRMLS_CC);
                        zend_error(E_WARNING, "%v%s%v() expects %s %d parameter%s, %d given",
                                        class_name, space,
                                        get_active_function_name(TSRMLS_C),
@@ -1027,9 +1025,9 @@ static int zend_merge_property(zval **value, int num_args, va_list args, zend_ha
 
                MAKE_STD_ZVAL(member);
                if (hash_key->type == IS_STRING) {
-                       ZVAL_STRINGL(member, hash_key->u.string, hash_key->nKeyLength-1, 1);
+                       ZVAL_STRINGL(member, hash_key->arKey.s, hash_key->nKeyLength-1, 1);
                } else if (hash_key->type == IS_UNICODE) {
-                       ZVAL_UNICODEL(member, hash_key->u.unicode, hash_key->nKeyLength-1, 1);
+                       ZVAL_UNICODEL(member, hash_key->arKey.u, hash_key->nKeyLength-1, 1);
                }
 
                obj_ht->write_property(obj, member, *value TSRMLS_CC);
@@ -1082,7 +1080,7 @@ ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC
 
                        zend_hash_internal_pointer_reset_ex(&class_type->default_static_members, &pos);
                        while (zend_hash_get_current_data_ex(&class_type->default_static_members, (void**)&p, &pos) == SUCCESS) {
-                               char *str_index;
+                               zstr str_index;
                                uint str_length;
                                ulong num_index;
                                zend_uchar utype;
@@ -1248,7 +1246,7 @@ ZEND_API int add_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str,
        return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
 }
 
-ZEND_API int add_assoc_unicode_ex(zval *arg, char *key, uint key_len, void *str, int duplicate)
+ZEND_API int add_assoc_unicode_ex(zval *arg, char *key, uint key_len, UChar *str, int duplicate)
 {
        zval *tmp;
 
@@ -1259,7 +1257,7 @@ ZEND_API int add_assoc_unicode_ex(zval *arg, char *key, uint key_len, void *str,
 }
 
 
-ZEND_API int add_assoc_unicodel_ex(zval *arg, char *key, uint key_len, void *str, uint length, int duplicate)
+ZEND_API int add_assoc_unicodel_ex(zval *arg, char *key, uint key_len, UChar *str, uint length, int duplicate)
 {
        zval *tmp;
 
@@ -1274,7 +1272,7 @@ ZEND_API int add_assoc_zval_ex(zval *arg, char *key, uint key_len, zval *value)
        return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &value, sizeof(zval *), NULL);
 }
 
-ZEND_API int add_u_assoc_zval_ex(zval *arg, zend_uchar type, void *key, uint key_len, zval *value)
+ZEND_API int add_u_assoc_zval_ex(zval *arg, zend_uchar type, zstr key, uint key_len, zval *value)
 {
        return zend_u_symtable_update(Z_ARRVAL_P(arg), type, key, key_len, (void *) &value, sizeof(zval *), NULL);
 }
@@ -1964,16 +1962,16 @@ ZEND_API zend_module_entry* zend_register_internal_module(zend_module_entry *mod
 ZEND_API void zend_check_magic_method_implementation(zend_class_entry *ce, zend_function *fptr, int error_type TSRMLS_DC)
 {
        unsigned int lcname_len;
-       char *lcname;
+       zstr lcname;
        int name_len;
        zend_uchar utype = UG(unicode)?IS_UNICODE:IS_STRING;
 
        /* we don't care if the function name is longer, in fact lowercasing only
         * the beginning of the name speeds up the check process */
        if (UG(unicode)) {
-               name_len = u_strlen((UChar*)fptr->common.function_name);
+               name_len = u_strlen(fptr->common.function_name.u);
        } else {
-               name_len = strlen(fptr->common.function_name);
+               name_len = strlen(fptr->common.function_name.s);
        }
        lcname = zend_u_str_case_fold(utype, fptr->common.function_name, name_len, 0, &lcname_len);
 
@@ -2002,7 +2000,7 @@ ZEND_API void zend_check_magic_method_implementation(zend_class_entry *ce, zend_
            ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_TOSTRING_FUNC_NAME, sizeof(ZEND_TOSTRING_FUNC_NAME)-1) && fptr->common.num_args != 0) {
                zend_error(error_type, "Method %v::%s() cannot take arguments", ce->name, ZEND_CALL_FUNC_NAME);
        }
-       efree(lcname);
+       efree(lcname.v);
 }
 
 /* registers all functions in *library_functions in the function hash */
@@ -2034,12 +2032,12 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
 
        if (scope) {
                class_name_len = scope->name_length;
-               lc_class_name = zend_str_tolower_dup(scope->name, class_name_len);
+               lc_class_name = zend_str_tolower_dup(scope->name.s, class_name_len);
        }
 
        while (ptr->fname) {
                internal_function->handler = ptr->handler;
-               internal_function->function_name = ptr->fname;
+               internal_function->function_name.s = ptr->fname;
                internal_function->scope = scope;
                internal_function->prototype = NULL;
                if (ptr->arg_info) {
@@ -2062,7 +2060,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
                }
                if (ptr->flags) {
                        if (!(ptr->flags & ZEND_ACC_PPP_MASK)) {
-                               zend_error(error_type, "Invalid access level for %s%s%s() - access must be exactly one of public, protected or private", scope ? scope->name : "", scope ? "::" : "", ptr->fname);
+                               zend_error(error_type, "Invalid access level for %s%s%s() - access must be exactly one of public, protected or private", scope ? scope->name.s : "", scope ? "::" : "", ptr->fname);
                                internal_function->fn_flags = ZEND_ACC_PUBLIC | ptr->flags;
                        } else {
                                internal_function->fn_flags = ptr->flags;
@@ -2082,7 +2080,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
                                }
                        }
                        if (ptr->flags & ZEND_ACC_STATIC && (!scope || (scope->ce_flags & ZEND_ACC_INTERFACE))) {
-                               zend_error(error_type, "Static function %s%s%s() cannot be abstract", scope ? scope->name : "", scope ? "::" : "", ptr->fname);
+                               zend_error(error_type, "Static function %s%s%s() cannot be abstract", scope ? scope->name.s : "", scope ? "::" : "", ptr->fname);
                        }
                } else {
                        if (scope && (scope->ce_flags & ZEND_ACC_INTERFACE)) {
@@ -2094,7 +2092,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
                                if (scope) {
                                        efree(lc_class_name);
                                }
-                               zend_error(error_type, "Method %s%s%s() cannot be a NULL function", scope ? scope->name : "", scope ? "::" : "", ptr->fname);
+                               zend_error(error_type, "Method %s%s%s() cannot be a NULL function", scope ? scope->name.s : "", scope ? "::" : "", ptr->fname);
                                zend_unregister_functions(functions, count, target_function_table TSRMLS_CC);
                                return FAILURE;
                        }
@@ -2152,7 +2150,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
                }
                while (ptr->fname) {
                        if (zend_hash_exists(target_function_table, ptr->fname, strlen(ptr->fname)+1)) {
-                               zend_error(error_type, "Function registration failed - duplicate name - %s%s%s", scope ? scope->name : "", scope ? "::" : "", ptr->fname);
+                               zend_error(error_type, "Function registration failed - duplicate name - %s%s%s", scope ? scope->name.s : "", scope ? "::" : "", ptr->fname);
                        }
                        ptr++;
                }
@@ -2366,7 +2364,7 @@ static zend_class_entry *do_register_internal_class(zend_class_entry *orig_class
                zend_register_functions(class_entry, class_entry->builtin_functions, &class_entry->function_table, MODULE_PERSISTENT TSRMLS_CC);
        }
 
-       zend_str_tolower_copy(lowercase_name, orig_class_entry->name, class_entry->name_length);
+       zend_str_tolower_copy(lowercase_name, orig_class_entry->name.s, class_entry->name_length);
        zend_hash_update(CG(class_table), lowercase_name, class_entry->name_length+1, &class_entry, sizeof(zend_class_entry *), NULL);
        free(lowercase_name);
        return class_entry;
@@ -2513,7 +2511,7 @@ ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_
 static int zend_is_callable_check_func(int check_flags, zval ***zobj_ptr_ptr, zend_class_entry *ce_org, zval *callable, zend_class_entry **ce_ptr, zend_function **fptr_ptr TSRMLS_DC)
 {
        int retval;
-       char *lcname, *lmname, *mname, *colon;
+       zstr lcname, lmname, mname, colon;
        unsigned int clen, mlen;
        zend_function *fptr;
        zend_class_entry **pce;
@@ -2523,30 +2521,31 @@ static int zend_is_callable_check_func(int check_flags, zval ***zobj_ptr_ptr, ze
        *fptr_ptr = NULL;
 
        if (Z_TYPE_P(callable) == IS_UNICODE) {
-               if ((colon = (char*)u_strstr((UChar*)Z_UNIVAL_P(callable), (UChar*)":\0:\0")) != NULL) {
-                       mlen = u_strlen((UChar*)(colon+4));
-                       clen = Z_UNILEN_P(callable) - mlen - 2;
-                       mname = colon + 4;
+               if ((colon.u = u_strstr(Z_USTRVAL_P(callable), (UChar*)":\0:\0")) != NULL) {
+                       mlen = u_strlen(colon.u+2);
+                       clen = Z_USTRLEN_P(callable) - mlen - 2;
+                       mname.u = colon.u + 2;
                }
        } else {
-               if ((colon = strstr(Z_STRVAL_P(callable), "::")) != NULL) {
-                       clen = colon - Z_STRVAL_P(callable);
+               if ((colon.s = strstr(Z_STRVAL_P(callable), "::")) != NULL) {
+                       clen = colon.s - Z_STRVAL_P(callable);
                        mlen = Z_STRLEN_P(callable) - clen - 2;
-                       mname = colon + 2;
+                       mname.s = colon.s + 2;
                }
        }
-       if (colon != NULL) {
-               if (zend_u_lookup_class(Z_TYPE_P(callable), Z_STRVAL_P(callable), clen, &pce TSRMLS_CC) == SUCCESS) {
+       if (colon.v != NULL) {
+               if (zend_u_lookup_class(Z_TYPE_P(callable), Z_UNIVAL_P(callable), clen, &pce TSRMLS_CC) == SUCCESS) {
                        *ce_ptr = *pce;
                } else {
                        lcname = zend_u_str_case_fold(Z_TYPE_P(callable), Z_UNIVAL_P(callable), clen, 0, &clen);
                        /* caution: lcname is not '\0' terminated */
-                       if (clen == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self") - 1) == 0) {
+                       /* FIXME: Unicode support??? */
+                       if (clen == sizeof("self") - 1 && memcmp(lcname.s, "self", sizeof("self") - 1) == 0) {
                                *ce_ptr = EG(scope);
-                       } else if (clen == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent") - 1) == 0 && EG(active_op_array)->scope) {
+                       } else if (clen == sizeof("parent") - 1 && memcmp(lcname.s, "parent", sizeof("parent") - 1) == 0 && EG(active_op_array)->scope) {
                                *ce_ptr = EG(scope) ? EG(scope)->parent : NULL;
                        }
-                       efree(lcname);
+                       efree(lcname.v);
                }
                if (!*ce_ptr) {
                        return 0;
@@ -2557,7 +2556,7 @@ static int zend_is_callable_check_func(int check_flags, zval ***zobj_ptr_ptr, ze
                }
                lmname = zend_u_str_case_fold(Z_TYPE_P(callable), mname, mlen, 0, &mlen);
        } else {
-               lmname = zend_u_str_case_fold(Z_TYPE_P(callable), Z_STRVAL_P(callable), Z_STRLEN_P(callable), 0, &mlen);
+               lmname = zend_u_str_case_fold(Z_TYPE_P(callable), Z_UNIVAL_P(callable), Z_UNILEN_P(callable), 0, &mlen);
                if (ce_org) {
                        ftable = &ce_org->function_table;
                        *ce_ptr = ce_org;
@@ -2566,7 +2565,7 @@ static int zend_is_callable_check_func(int check_flags, zval ***zobj_ptr_ptr, ze
                }
        }
 
-       retval = zend_hash_find(ftable, lmname, mlen+1, (void**)&fptr) == SUCCESS ? 1 : 0;
+       retval = zend_u_hash_find(ftable, Z_TYPE_P(callable), lmname, mlen+1, (void**)&fptr) == SUCCESS ? 1 : 0;
 
        if (!retval) {
                if (*zobj_ptr_ptr && *ce_ptr && (*ce_ptr)->__call != 0) {
@@ -2596,13 +2595,13 @@ static int zend_is_callable_check_func(int check_flags, zval ***zobj_ptr_ptr, ze
                        }
                }
        }
-       efree(lmname);
+       efree(lmname.v);
        return retval;
 }
 
 ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, zval *callable_name, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval ***zobj_ptr_ptr TSRMLS_DC)
 {
-       char *lcname;
+       zstr lcname;
        unsigned int lcname_len;
        zend_class_entry *ce_local, **pce;
        zend_function *fptr_local;
@@ -2724,7 +2723,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, zval *c
                                                } else if (zend_u_lookup_class(Z_TYPE_PP(obj), Z_UNIVAL_PP(obj), Z_UNILEN_PP(obj), &pce TSRMLS_CC) == SUCCESS) {
                                                        ce = *pce;
                                                }
-                                               efree(lcname);
+                                               efree(lcname.v);
                                        } else {
                                                ce = Z_OBJCE_PP(obj); /* TBFixed: what if it's overloaded? */
 
@@ -2735,7 +2734,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, zval *c
                                                                Z_TYPE_P(callable_name) = IS_UNICODE;
                                                                Z_USTRLEN_P(callable_name) = ce->name_length + Z_UNILEN_PP(method) + 2;
                                                                Z_USTRVAL_P(callable_name) = eumalloc(Z_USTRLEN_P(callable_name)+1);
-                                                               memcpy(Z_USTRVAL_P(callable_name), ce->name, UBYTES(ce->name_length));
+                                                               memcpy(Z_USTRVAL_P(callable_name), ce->name.u, UBYTES(ce->name_length));
                                                                Z_USTRVAL_P(callable_name)[ce->name_length] = ':';
                                                                Z_USTRVAL_P(callable_name)[ce->name_length+1] = ':';
                                                                if (Z_TYPE_PP(method) == IS_UNICODE) {
@@ -2752,7 +2751,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, zval *c
                                                                Z_TYPE_P(callable_name) = IS_STRING;
                                                                Z_STRLEN_P(callable_name) = ce->name_length + Z_UNILEN_PP(method) + 2;
                                                                Z_STRVAL_P(callable_name) = emalloc(Z_STRLEN_P(callable_name)+1);
-                                                               memcpy(Z_STRVAL_P(callable_name), ce->name, ce->name_length);
+                                                               memcpy(Z_STRVAL_P(callable_name), ce->name.s, ce->name_length);
                                                                Z_STRVAL_P(callable_name)[ce->name_length] = ':';
                                                                Z_STRVAL_P(callable_name)[ce->name_length+1] = ':';
                                                                if (Z_TYPE_PP(method) == IS_STRING) {
@@ -2849,7 +2848,7 @@ ZEND_API char *zend_get_module_version(char *module_name)
        return module->version;
 }
 
-ZEND_API int zend_u_declare_property_ex(zend_class_entry *ce, zend_uchar type, void *name, int name_length, zval *property, int access_type, char *doc_comment, int doc_comment_len TSRMLS_DC)
+ZEND_API int zend_u_declare_property_ex(zend_class_entry *ce, zend_uchar type, zstr name, int name_length, zval *property, int access_type, char *doc_comment, int doc_comment_len TSRMLS_DC)
 {
        zend_property_info property_info;
        HashTable *target_symbol_table;
@@ -2876,7 +2875,7 @@ ZEND_API int zend_u_declare_property_ex(zend_class_entry *ce, zend_uchar type, v
        }
        switch (access_type & ZEND_ACC_PPP_MASK) {
                case ZEND_ACC_PRIVATE: {
-                               char *priv_name;
+                               zstr priv_name;
                                int priv_name_length;
 
                                zend_u_mangle_property_name(&priv_name, &priv_name_length, type, ce->name, ce->name_length, name, name_length, ce->type & ZEND_INTERNAL_CLASS);
@@ -2886,10 +2885,10 @@ ZEND_API int zend_u_declare_property_ex(zend_class_entry *ce, zend_uchar type, v
                        }
                        break;
                case ZEND_ACC_PROTECTED: {
-                               char *prot_name;
+                               zstr prot_name;
                                int prot_name_length;
 
-                               zend_u_mangle_property_name(&prot_name, &prot_name_length, type, "*", 1, name, name_length, ce->type & ZEND_INTERNAL_CLASS);
+                               zend_u_mangle_property_name(&prot_name, &prot_name_length, type, (zstr)"*", 1, name, name_length, ce->type & ZEND_INTERNAL_CLASS);
                                zend_u_hash_update(target_symbol_table, type, prot_name, prot_name_length+1, &property, sizeof(zval *), NULL);
                                property_info.name = prot_name;
                                property_info.name_length = prot_name_length;
@@ -2897,17 +2896,17 @@ ZEND_API int zend_u_declare_property_ex(zend_class_entry *ce, zend_uchar type, v
                        break;
                case ZEND_ACC_PUBLIC:
                        if (ce->parent) {
-                               char *prot_name;
+                               zstr prot_name;
                                int prot_name_length;
 
-                               zend_u_mangle_property_name(&prot_name, &prot_name_length, type, "*", 1, name, name_length, ce->type & ZEND_INTERNAL_CLASS);
+                               zend_u_mangle_property_name(&prot_name, &prot_name_length, type, (zstr)"*", 1, name, name_length, ce->type & ZEND_INTERNAL_CLASS);
                                zend_u_hash_del(target_symbol_table, type, prot_name, prot_name_length+1);
-                               pefree(prot_name, ce->type & ZEND_INTERNAL_CLASS);
+                               pefree(prot_name.v, ce->type & ZEND_INTERNAL_CLASS);
                        }
                        zend_u_hash_update(target_symbol_table, type, name, name_length+1, &property, sizeof(zval *), NULL);
-                       property_info.name = ce->type & ZEND_INTERNAL_CLASS ?
-                               (type==IS_UNICODE?(char*)zend_ustrndup(name, name_length):zend_strndup(name, name_length)) :
-                               (type==IS_UNICODE?(char*)eustrndup(name, name_length):estrndup(name, name_length));
+                       property_info.name.s = ce->type & ZEND_INTERNAL_CLASS ?
+                               (type==IS_UNICODE?(char*)zend_ustrndup(name.u, name_length):zend_strndup(name.s, name_length)) :
+                               (type==IS_UNICODE?(char*)eustrndup(name.u, name_length):estrndup(name.s, name_length));
                        property_info.name_length = name_length;
                        break;
        }
@@ -2924,17 +2923,17 @@ ZEND_API int zend_u_declare_property_ex(zend_class_entry *ce, zend_uchar type, v
 
 ZEND_API int zend_declare_property_ex(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type, char *doc_comment, int doc_comment_len TSRMLS_DC)
 {
-       return zend_u_declare_property_ex(ce, IS_STRING, name, name_length, property, access_type, NULL, 0 TSRMLS_CC);
+       return zend_u_declare_property_ex(ce, IS_STRING, (zstr)name, name_length, property, access_type, NULL, 0 TSRMLS_CC);
 }
 
-ZEND_API int zend_u_declare_property(zend_class_entry *ce, zend_uchar type, void *name, int name_length, zval *property, int access_type TSRMLS_DC)
+ZEND_API int zend_u_declare_property(zend_class_entry *ce, zend_uchar type, zstr name, int name_length, zval *property, int access_type TSRMLS_DC)
 {
        return zend_u_declare_property_ex(ce, type, name, name_length, property, access_type, NULL, 0 TSRMLS_CC);
 }
 
 ZEND_API int zend_declare_property(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type TSRMLS_DC)
 {
-       return zend_u_declare_property_ex(ce, IS_STRING, name, name_length, property, access_type, NULL, 0 TSRMLS_CC);
+       return zend_u_declare_property_ex(ce, IS_STRING, (zstr)name, name_length, property, access_type, NULL, 0 TSRMLS_CC);
 }
 
 ZEND_API int zend_declare_property_null(zend_class_entry *ce, char *name, int name_length, int access_type TSRMLS_DC)
@@ -3098,12 +3097,12 @@ ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, char *
        EG(scope) = scope;
 
        if (!Z_OBJ_HT_P(object)->write_property) {
-               char *class_name;
+               zstr class_name;
                zend_uint class_name_len;
 
                zend_get_object_classname(object, &class_name, &class_name_len TSRMLS_CC);
 
-               zend_error(E_CORE_ERROR, "Property %s of class %v cannot be updated", name, class_name);
+               zend_error(E_CORE_ERROR, "Property %s of class %v cannot be updated", name, class_name.v);
        }
        MAKE_STD_ZVAL(property);
        ZVAL_ASCII_STRINGL(property, name, name_length, 1);
@@ -3251,7 +3250,7 @@ ZEND_API int zend_update_static_property(zend_class_entry *scope, char *name, in
        zend_class_entry *old_scope = EG(scope);
 
        EG(scope) = scope;
-       property = zend_std_get_static_property(scope, IS_STRING, name, name_length, 0 TSRMLS_CC);
+       property = zend_std_get_static_property(scope, IS_STRING, (zstr)name, name_length, 0 TSRMLS_CC);
        EG(scope) = old_scope;
        if (!property) {
                return FAILURE;
@@ -3419,11 +3418,11 @@ ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *n
        EG(scope) = scope;
 
        if (!Z_OBJ_HT_P(object)->read_property) {
-               char *class_name;
+               zstr class_name;
                zend_uint class_name_len;
 
                zend_get_object_classname(object, &class_name, &class_name_len TSRMLS_CC);
-               zend_error(E_CORE_ERROR, "Property %s of class %v cannot be read", name, class_name);
+               zend_error(E_CORE_ERROR, "Property %s of class %v cannot be read", name, class_name.v);
        }
 
        MAKE_STD_ZVAL(property);
@@ -3441,7 +3440,7 @@ ZEND_API zval *zend_read_static_property(zend_class_entry *scope, char *name, in
        zend_class_entry *old_scope = EG(scope);
 
        EG(scope) = scope;
-       property = zend_std_get_static_property(scope, IS_STRING, name, name_length, silent TSRMLS_CC);
+       property = zend_std_get_static_property(scope, IS_STRING, (zstr)name, name_length, silent TSRMLS_CC);
        EG(scope) = old_scope;
 
        return property?*property:NULL;
index 581a01d995be57ea1fc93deac71ad4284260bd08..c407ceea480ffa9a6d6c4fcb4eb0d894ab2efd46 100644 (file)
@@ -57,13 +57,13 @@ typedef struct _zend_function_entry {
                                                     ZEND_FENTRY(name, ZEND_FN(classname##_##alias), arg_info, flags)
 #define ZEND_ME_MAPPING(name, func_name, arg_types) ZEND_NAMED_FE(name, ZEND_FN(func_name), arg_types)
 
-#define ZEND_ARG_INFO(pass_by_ref, name)                                                       { #name, sizeof(#name)-1, NULL, 0, 0, 0, pass_by_ref, 0, 0 },
-#define ZEND_ARG_PASS_INFO(pass_by_ref)                                                                { NULL, 0, NULL, 0, 0, 0, pass_by_ref, 0, 0 },
-#define ZEND_ARG_OBJ_INFO(pass_by_ref, name, classname, allow_null) { #name, sizeof(#name)-1, #classname, sizeof(#classname)-1, 0, allow_null, pass_by_ref, 0, 0 },
-#define ZEND_ARG_ARRAY_INFO(pass_by_ref, name, allow_null) { #name, sizeof(#name)-1, NULL, 0, 1, allow_null, pass_by_ref, 0, 0 },
+#define ZEND_ARG_INFO(pass_by_ref, name)                                                       { {#name}, sizeof(#name)-1, {NULL}, 0, 0, 0, pass_by_ref, 0, 0 },
+#define ZEND_ARG_PASS_INFO(pass_by_ref)                                                                { {NULL}, 0, {NULL}, 0, 0, 0, pass_by_ref, 0, 0 },
+#define ZEND_ARG_OBJ_INFO(pass_by_ref, name, classname, allow_null) { {#name}, sizeof(#name)-1, {#classname}, sizeof(#classname)-1, 0, allow_null, pass_by_ref, 0, 0 },
+#define ZEND_ARG_ARRAY_INFO(pass_by_ref, name, allow_null) { {#name}, sizeof(#name)-1, {NULL}, 0, 1, allow_null, pass_by_ref, 0, 0 },
 #define ZEND_BEGIN_ARG_INFO_EX(name, pass_rest_by_reference, return_reference, required_num_args)      \
        zend_arg_info name[] = {                                                                                                                                                \
-               { NULL, 0, NULL, 0, 0, 0, pass_rest_by_reference, return_reference, required_num_args },
+               { {NULL}, 0, {NULL}, 0, 0, 0, pass_rest_by_reference, return_reference, required_num_args },
 #define ZEND_BEGIN_ARG_INFO(name, pass_rest_by_reference)      \
        ZEND_BEGIN_ARG_INFO_EX(name, pass_rest_by_reference, ZEND_RETURN_VALUE, -1)
 #define ZEND_END_ARG_INFO()            };
@@ -118,7 +118,7 @@ typedef struct _zend_function_entry {
 
 #define INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, functions, handle_fcall, handle_propget, handle_propset, handle_propunset, handle_propisset) \
        {                                                                                                                       \
-               class_container.name = strdup(class_name);                              \
+               class_container.name.s = strdup(class_name);                    \
                class_container.name_length = sizeof(class_name) - 1;   \
                class_container.builtin_functions = functions;                  \
                class_container.constructor = NULL;                                             \
@@ -223,8 +223,8 @@ ZEND_API int zend_declare_property_double(zend_class_entry *ce, char *name, int
 ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int name_length, char *value, int access_type TSRMLS_DC);
 ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, char *name, int name_length, char *value, int value_len, int access_type TSRMLS_DC);
 
-ZEND_API int zend_u_declare_property(zend_class_entry *ce, zend_uchar type, void *name, int name_length, zval *property, int access_type TSRMLS_DC);
-ZEND_API int zend_u_declare_property_ex(zend_class_entry *ce, zend_uchar type, void *name, int name_length, zval *property, int access_type, char *doc_comment, int doc_comment_len TSRMLS_DC);
+ZEND_API int zend_u_declare_property(zend_class_entry *ce, zend_uchar type, zstr name, int name_length, zval *property, int access_type TSRMLS_DC);
+ZEND_API int zend_u_declare_property_ex(zend_class_entry *ce, zend_uchar type, zstr name, int name_length, zval *property, int access_type, char *doc_comment, int doc_comment_len TSRMLS_DC);
 
 ZEND_API int zend_declare_class_constant(zend_class_entry *ce, char *name, size_t name_length, zval *value TSRMLS_DC);
 ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, char *name, size_t name_length, long value TSRMLS_DC);
@@ -267,7 +267,7 @@ ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *n
 ZEND_API zval *zend_read_static_property(zend_class_entry *scope, char *name, int name_length, zend_bool silent TSRMLS_DC);
 
 ZEND_API zend_class_entry *zend_get_class_entry(zval *zobject TSRMLS_DC);
-ZEND_API int zend_get_object_classname(zval *object, char **class_name, zend_uint *class_name_len TSRMLS_DC);
+ZEND_API int zend_get_object_classname(zval *object, zstr *class_name, zend_uint *class_name_len TSRMLS_DC);
 ZEND_API zend_uchar zend_get_unified_string_type(int num_args TSRMLS_DC, ...);
 
 #define getThis() (this_ptr)
@@ -304,22 +304,22 @@ ZEND_API int add_assoc_resource_ex(zval *arg, char *key, uint key_len, int r);
 ZEND_API int add_assoc_double_ex(zval *arg, char *key, uint key_len, double d);
 ZEND_API int add_assoc_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate);
 ZEND_API int add_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate);
-ZEND_API int add_assoc_unicode_ex(zval *arg, char *key, uint key_len, void *str, int duplicate);
-ZEND_API int add_assoc_unicodel_ex(zval *arg, char *key, uint key_len, void *str, uint length, int duplicate);
+ZEND_API int add_assoc_unicode_ex(zval *arg, char *key, uint key_len, UChar *str, int duplicate);
+ZEND_API int add_assoc_unicodel_ex(zval *arg, char *key, uint key_len, UChar *str, uint length, int duplicate);
 ZEND_API int add_assoc_zval_ex(zval *arg, char *key, uint key_len, zval *value);
 
 #define add_assoc_text_ex(arg, key, key_len, str, duplicate) \
        if (UG(unicode)) { \
-               add_assoc_unicode_ex(arg, key, key_len, (UChar*)(str), duplicate); \
+               add_assoc_unicode_ex(arg, key, key_len, (str).u, duplicate); \
        } else { \
-               add_assoc_string_ex(arg, key, key_len, (char*)(str), duplicate); \
+               add_assoc_string_ex(arg, key, key_len, (str).s, duplicate); \
        }
 
 #define add_assoc_textl_ex(arg, key, key_len, str, length, duplicate) \
        if (UG(unicode)) { \
-               add_assoc_unicodel_ex(arg, key, key_len, (UChar*)(str), length, duplicate); \
+               add_assoc_unicodel_ex(arg, key, key_len, (str).u, length, duplicate); \
        } else { \
-               add_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, duplicate); \
+               add_assoc_stringl_ex(arg, key, key_len, (str).s, length, duplicate); \
        }
 
 #define add_assoc_ascii_string_ex(arg, key, key_len, str, duplicate) \
@@ -343,7 +343,7 @@ ZEND_API int add_assoc_zval_ex(zval *arg, char *key, uint key_len, zval *value);
        if (UG(unicode)) { \
     UErrorCode status = U_ZERO_ERROR; \
                UChar *u_str; \
-               int32_t u_len; \
+               int u_len; \
                int length = strlen(str); \
                zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, str, length, &status); \
                add_assoc_unicodel_ex(arg, key, key_len, u_str, u_len, 0); \
@@ -355,7 +355,7 @@ ZEND_API int add_assoc_zval_ex(zval *arg, char *key, uint key_len, zval *value);
        if (UG(unicode)) { \
     UErrorCode status = U_ZERO_ERROR; \
                UChar *u_str; \
-               int32_t u_len; \
+               int u_len; \
                zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, str, length, &status); \
                add_assoc_unicodel_ex(arg, key, key_len, u_str, u_len, 0); \
        } else { \
@@ -406,9 +406,9 @@ ZEND_API int add_assoc_zval_ex(zval *arg, char *key, uint key_len, zval *value);
                add_assoc_stringl(arg, key, (char*)(str), length, duplicate); \
        }
 
-ZEND_API int add_u_assoc_zval_ex(zval *arg, zend_uchar type, void *key, uint key_len, zval *value);
+ZEND_API int add_u_assoc_zval_ex(zval *arg, zend_uchar type, zstr key, uint key_len, zval *value);
 
-#define add_u_assoc_zval(__arg, __type, __key, __value) add_u_assoc_zval_ex(__arg, __type, __key, (((__type)==IS_UNICODE)?u_strlen((UChar*)__key):strlen(__key))+1, __value)
+#define add_u_assoc_zval(__arg, __type, __key, __value) add_u_assoc_zval_ex(__arg, __type, __key, (((__type)==IS_UNICODE)?u_strlen((__key).u):strlen((__key).s))+1, __value)
 
 /* unset() functions are only suported for legacy modules and null() functions should be used */
 #define add_assoc_unset(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key) + 1)
@@ -471,16 +471,16 @@ ZEND_API int add_next_index_zval(zval *arg, zval *value);
 
 #define add_next_index_text(arg, str, duplicate) \
        if (UG(unicode)) { \
-               add_next_index_unicode(arg, (UChar*)(str), duplicate); \
+               add_next_index_unicode(arg, (str).u, duplicate); \
        } else { \
-               add_next_index_string(arg, (char*)(str), duplicate); \
+               add_next_index_string(arg, (str).s, duplicate); \
        }
 
 #define add_next_index_textl(arg, str, length, duplicate) \
        if (UG(unicode)) { \
-               add_next_index_unicodel(arg, (UChar*)(str), length, duplicate); \
+               add_next_index_unicodel(arg, (str).u, length, duplicate); \
        } else { \
-               add_next_index_stringl(arg, (char*)(str), length, duplicate); \
+               add_next_index_stringl(arg, (str).s, length, duplicate); \
        }
 
 #define add_next_index_ascii_string(arg, str, duplicate) \
@@ -504,7 +504,7 @@ ZEND_API int add_next_index_zval(zval *arg, zval *value);
        if (UG(unicode)) { \
     UErrorCode status = U_ZERO_ERROR; \
                UChar *u_str; \
-               int32_t u_len; \
+               int u_len; \
                int length = strlen(str); \
                zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, str, length, &status); \
                add_next_index_unicodel(arg, u_str, u_len, 0); \
@@ -516,7 +516,7 @@ ZEND_API int add_next_index_zval(zval *arg, zval *value);
        if (UG(unicode)) { \
     UErrorCode status = U_ZERO_ERROR; \
                UChar *u_str; \
-               int32_t u_len; \
+               int u_len; \
                zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, str, length, &status); \
                add_next_index_unicodel(arg, u_str, u_len, 0); \
        } else { \
@@ -600,7 +600,7 @@ ZEND_API int zend_set_hash_symbol(zval *symbol, char *name, int name_length,
                                   zend_bool is_ref, int num_symbol_tables, ...);
 
 ZEND_API int zend_delete_global_variable(char *name, int name_len TSRMLS_DC);
-ZEND_API int zend_u_delete_global_variable(zend_uchar type, void *name, int name_len TSRMLS_DC);
+ZEND_API int zend_u_delete_global_variable(zend_uchar type, zstr name, int name_len TSRMLS_DC);
 
 ZEND_API void zend_reset_all_cv(HashTable *symbol_table TSRMLS_DC);
 
@@ -690,9 +690,9 @@ END_EXTERN_C()
 
 #define ZVAL_U_STRING(conv, z, s, duplicate) \
        if (UG(unicode)) { \
-    UErrorCode status = U_ZERO_ERROR; \
+               UErrorCode status = U_ZERO_ERROR; \
                UChar *u_str; \
-               int32_t u_len; \
+               int u_len; \
                uint length = strlen(s); \
                zend_convert_to_unicode(conv, &u_str, &u_len, s, length, &status); \
                ZVAL_UNICODEL(z, u_str, u_len, 0); \
@@ -705,9 +705,9 @@ END_EXTERN_C()
 
 #define ZVAL_U_STRINGL(conv, z, s, l, duplicate) \
        if (UG(unicode)) { \
-    UErrorCode status = U_ZERO_ERROR; \
+               UErrorCode status = U_ZERO_ERROR; \
                UChar *u_str; \
-               int32_t u_len; \
+               int u_len; \
                zend_convert_to_unicode(conv, &u_str, &u_len, s, l, &status); \
                ZVAL_UNICODEL(z, u_str, u_len, 0); \
        } else { \
@@ -731,8 +731,8 @@ END_EXTERN_C()
 }
 
 #define ZVAL_UNICODEL(z, u, l, duplicate) {    \
-       UChar *__u=(u); int32_t __l=l;                  \
-               Z_USTRLEN_P(z) = __l;       \
+               UChar *__u=(u); int __l=l;                      \
+               Z_USTRLEN_P(z) = __l;                           \
                Z_USTRVAL_P(z) = (duplicate?eustrndup(__u, __l):__u);   \
                Z_TYPE_P(z) = IS_UNICODE;                   \
 }
@@ -770,18 +770,18 @@ END_EXTERN_C()
 #define ZVAL_TEXT(z, t, duplicate)                                     \
                do {                                                                            \
                        if (UG(unicode)) {                                              \
-                               ZVAL_UNICODE(z, (UChar*)(t), duplicate);                \
+                               ZVAL_UNICODE(z, t.u, duplicate);        \
                        } else {                                                                \
-                               ZVAL_STRING(z, (char*)(t), duplicate);          \
+                               ZVAL_STRING(z, t.s, duplicate);         \
                        }                                                                               \
                } while (0);
 
 #define ZVAL_TEXTL(z, t, l, duplicate)                         \
                do {                                                                            \
                        if (UG(unicode)) {                                              \
-                               ZVAL_UNICODEL(z, (UChar*)(t), l, duplicate);    \
+                               ZVAL_UNICODEL(z, t.u, l, duplicate);\
                        } else {                                                                \
-                               ZVAL_STRINGL(z, (char*)(t), l, duplicate);      \
+                               ZVAL_STRINGL(z, t.s, l, duplicate);     \
                        }                                                                               \
                } while (0);
 
@@ -910,7 +910,7 @@ END_EXTERN_C()
        }
 
 #define ZEND_SET_SYMBOL_WITH_LENGTH(symtable, name, name_length, var, _refcount, _is_ref)                              \
-       ZEND_U_SET_SYMBOL_WITH_LENGTH(symtable, IS_STRING, name, name_length, var, _refcount, _is_ref)
+       ZEND_U_SET_SYMBOL_WITH_LENGTH(symtable, IS_STRING, (zstr)name, name_length, var, _refcount, _is_ref)
 
 #define ZEND_SET_GLOBAL_VAR(name, var)                         \
        ZEND_SET_SYMBOL(&EG(symbol_table), name, var)
index 478f9df8c269df5a68faef2c12a7257219688896..3b1ba0c61360eaf841a9d4fce6dfea3b4b4a7c8a 100644 (file)
@@ -446,7 +446,7 @@ ZEND_API char *_estrndup(const char *s, uint length ZEND_FILE_LINE_DC ZEND_FILE_
 }
 
 
-ZEND_API UChar *_eustrndup(const UChar *s, int32_t length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+ZEND_API UChar *_eustrndup(const UChar *s, int length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
 {
        UChar *p;
 
index 50994c78c94d53e109fca953bfbf52be4353bcc9..77ed3912c1e9c07b5b68849cbfa68c9249297f1b 100644 (file)
@@ -87,7 +87,7 @@ ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LIN
 ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
 ZEND_API char *_estrndup(const char *s, unsigned int length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
 ZEND_API UChar *_eustrdup(const UChar *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
-ZEND_API UChar *_eustrndup(const UChar *s, int32_t length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
+ZEND_API UChar *_eustrndup(const UChar *s, int length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
 
 #if USE_ZEND_ALLOC
 
index 0d3501169119771fb17154fac7e05127506ae199..86e1270b0f7a6c3ba586832506274d67121c57e3 100644 (file)
@@ -304,7 +304,7 @@ ZEND_NAMED_FUNCTION(zend_if_strlen)
 ZEND_FUNCTION(strcmp)
 {
        void *s1, *s2;
-       int32_t s1_len, s2_len;
+       int s1_len, s2_len;
        zend_uchar s1_type, s2_type;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "TT", &s1, &s1_len,
@@ -325,7 +325,7 @@ ZEND_FUNCTION(strcmp)
 ZEND_FUNCTION(strncmp)
 {
        void *s1, *s2;
-       int32_t s1_len, s2_len;
+       int s1_len, s2_len;
        long count;
        zend_uchar s1_type, s2_type;
 
@@ -347,7 +347,7 @@ ZEND_FUNCTION(strncmp)
 ZEND_FUNCTION(strcasecmp)
 {
        void *s1, *s2;
-       int32_t s1_len, s2_len;
+       int s1_len, s2_len;
        zend_uchar s1_type, s2_type;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "TT", &s1, &s1_len,
@@ -390,7 +390,7 @@ ZEND_FUNCTION(strncasecmp)
 ZEND_FUNCTION(each)
 {
        zval **array, *entry, **entry_ptr, *tmp;
-       char *string_key;
+       zstr string_key;
        uint string_key_len;
        ulong num_key;
        zval **inserted_pointer;
@@ -428,10 +428,10 @@ ZEND_FUNCTION(each)
        /* add the key elements */
        switch (zend_hash_get_current_key_ex(target_hash, &string_key, &string_key_len, &num_key, 1, NULL)) {
                case HASH_KEY_IS_STRING:
-                       add_get_index_stringl(return_value, 0, string_key, string_key_len-1, (void **) &inserted_pointer, 0);
+                       add_get_index_stringl(return_value, 0, string_key.s, string_key_len-1, (void **) &inserted_pointer, 0);
                        break;
                case HASH_KEY_IS_UNICODE:
-                       add_get_index_unicodel(return_value, 0, (UChar*)string_key, string_key_len-1, (void **) &inserted_pointer, 0);
+                       add_get_index_unicodel(return_value, 0, string_key.u, string_key_len-1, (void **) &inserted_pointer, 0);
                        break;
                case HASH_KEY_IS_LONG:
                        add_get_index_long(return_value, 0, num_key, (void **) &inserted_pointer);
@@ -526,9 +526,9 @@ ZEND_FUNCTION(define)
        zval_copy_ctor(&c.value);
        c.flags = case_sensitive; /* non persistent */
        if (Z_TYPE_PP(var) == IS_UNICODE) {
-               c.name = (char*)zend_ustrndup(Z_USTRVAL_PP(var), Z_USTRLEN_PP(var));
+               c.name.u = zend_ustrndup(Z_USTRVAL_PP(var), Z_USTRLEN_PP(var));
        } else {
-               c.name = zend_strndup(Z_STRVAL_PP(var), Z_STRLEN_PP(var));
+               c.name.s = zend_strndup(Z_STRVAL_PP(var), Z_STRLEN_PP(var));
        }
        c.name_len = Z_UNILEN_PP(var)+1;
        c.module_number = PHP_USER_CONSTANT;
@@ -568,7 +568,7 @@ ZEND_FUNCTION(defined)
 ZEND_FUNCTION(get_class)
 {
        zval **arg;
-       char *name = (char*)EMPTY_STR;
+       zstr name = (zstr)EMPTY_STR;
        zend_uint name_len = 0;
        int dup;
 
@@ -599,7 +599,7 @@ ZEND_FUNCTION(get_parent_class)
 {
        zval **arg;
        zend_class_entry *ce = NULL;
-       char *name;
+       zstr name;
        zend_uint name_length;
 
        if (!ZEND_NUM_ARGS()) {
@@ -727,7 +727,7 @@ static void add_class_vars(zend_class_entry *ce, HashTable *properties, zval *re
 
                zend_hash_internal_pointer_reset_ex(properties, &pos);
                while (zend_hash_get_current_data_ex(properties, (void **) &prop, &pos) == SUCCESS) {
-                       char *key, *class_name, *prop_name;
+                       zstr key, class_name, prop_name;
                        uint key_len;
                        ulong num_index;
                        zval *prop_copy;
@@ -735,9 +735,10 @@ static void add_class_vars(zend_class_entry *ce, HashTable *properties, zval *re
 
                        key_type = zend_hash_get_current_key_ex(properties, &key, &key_len, &num_index, 0, &pos);
                        zend_hash_move_forward_ex(properties, &pos);
-                       zend_unmangle_property_name(key, &class_name, &prop_name);
-                       if (class_name) {
-                               if (class_name[0] != '*' && strcmp(class_name, ce->name)) {
+                       zend_u_unmangle_property_name(key_type, key, &class_name, &prop_name);
+                       if (class_name.v) {
+                               /* FIXME: Unicode support??? */
+                               if (class_name.s[0] != '*' && strcmp(class_name.s, ce->name.s)) {
                                        /* filter privates from base classes */
                                        continue;
                                } else if (!instanceof) {
@@ -769,7 +770,7 @@ static void add_class_vars(zend_class_entry *ce, HashTable *properties, zval *re
    Returns an array of default properties of the class. */
 ZEND_FUNCTION(get_class_vars)
 {
-       char *class_name;
+       zstr class_name;
        int class_name_len;
        zend_uchar type;
        zend_class_entry **pce;
@@ -798,7 +799,7 @@ ZEND_FUNCTION(get_object_vars)
        zval **value;
        HashTable *properties;
        HashPosition pos;
-       char *key, *prop_name, *class_name;
+       zstr key, prop_name, class_name;
        uint key_len;
        ulong num_index;
        int instanceof;
@@ -829,14 +830,14 @@ ZEND_FUNCTION(get_object_vars)
        while (zend_hash_get_current_data_ex(properties, (void **) &value, &pos) == SUCCESS) {
                if (zend_hash_get_current_key_ex(properties, &key, &key_len, &num_index, 0, &pos) == (UG(unicode)?HASH_KEY_IS_UNICODE:HASH_KEY_IS_STRING)) {
                        zend_u_unmangle_property_name(UG(unicode)?IS_UNICODE:IS_STRING, key, &class_name, &prop_name);
-                       if (class_name == NULL) {
+                       if (class_name.v == NULL) {
                                /* Not separating references */
                                (*value)->refcount++;
                                add_u_assoc_zval_ex(return_value, UG(unicode)?IS_UNICODE:IS_STRING, key, key_len, *value);
                        } else if (instanceof) {
-                               if (class_name[0] == '*' ||
+                               if (class_name.s[0] == '*' ||
                                    (Z_OBJCE_P(EG(This)) == Z_OBJCE_PP(obj) &&
-                                   UG(unicode)?!u_strcmp((UChar*)Z_OBJCE_P(EG(This))->name, (UChar*)class_name):!strcmp(Z_OBJCE_P(EG(This))->name, class_name))) {
+                                   UG(unicode)?!u_strcmp(Z_OBJCE_P(EG(This))->name.u, class_name.u):!strcmp(Z_OBJCE_P(EG(This))->name.s, class_name.s))) {
                                        /* Not separating references */
                                        (*value)->refcount++;
                                        add_u_assoc_zval(return_value, UG(unicode)?IS_UNICODE:IS_STRING, prop_name, *value);
@@ -905,7 +906,7 @@ ZEND_FUNCTION(method_exists)
 {
        zval **klass, **method_name;
        unsigned int lcname_len;
-       char *lcname;
+       zstr lcname;
        zend_class_entry * ce, **pce;
 
        if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &klass, &method_name)==FAILURE) {
@@ -927,20 +928,20 @@ ZEND_FUNCTION(method_exists)
        }
        lcname = zend_u_str_case_fold(Z_TYPE_PP(method_name), Z_UNIVAL_PP(method_name), Z_UNILEN_PP(method_name), 1, &lcname_len);
        if (zend_u_hash_exists(&ce->function_table, Z_TYPE_PP(method_name), lcname, lcname_len+1)) {
-               efree(lcname);
+               efree(lcname.v);
                RETURN_TRUE;
        } else {
                union _zend_function *func = NULL;
-               efree(lcname);
+               efree(lcname.v);
 
                if (Z_TYPE_PP(klass) == IS_OBJECT
                && Z_OBJ_HT_PP(klass)->get_method != NULL
-               && (func = Z_OBJ_HT_PP(klass)->get_method(klass, Z_STRVAL_PP(method_name), Z_STRLEN_PP(method_name) TSRMLS_CC)) != NULL
+               && (func = Z_OBJ_HT_PP(klass)->get_method(klass, Z_UNIVAL_PP(method_name), Z_UNILEN_PP(method_name) TSRMLS_CC)) != NULL
                ) {
                        if (func->type == ZEND_INTERNAL_FUNCTION
                        && ((zend_internal_function*)func)->handler == zend_std_call_user_call
                        ) {
-                               efree(((zend_internal_function*)func)->function_name);
+                               efree(((zend_internal_function*)func)->function_name.v);
                                efree(func);
                                RETURN_FALSE;
                        }
@@ -958,7 +959,7 @@ ZEND_FUNCTION(property_exists)
        zval **object, **property;
        zend_class_entry *ce, **pce;
        zend_property_info *property_info;
-       char *prop_name, *class_name;
+       zstr prop_name, class_name;
 
        if (ZEND_NUM_ARGS()!= 2 || zend_get_parameters_ex(2, &object, &property)==FAILURE) {
                ZEND_WRONG_PARAM_COUNT();
@@ -993,7 +994,7 @@ ZEND_FUNCTION(property_exists)
                        RETURN_TRUE;
                }
                zend_u_unmangle_property_name(Z_TYPE_PP(property), property_info->name, &class_name, &prop_name);
-               if (class_name[0] ==  '*') {
+               if (class_name.s[0] ==  '*') {
                        if (instanceof_function(EG(scope), ce TSRMLS_CC)) {
                                RETURN_TRUE;
                        }
@@ -1026,7 +1027,7 @@ ZEND_FUNCTION(property_exists)
 ZEND_FUNCTION(class_exists)
 {
        unsigned int lc_name_len;
-       void *class_name, *lc_name;
+       zstr class_name, lc_name;
        zend_class_entry **ce;
        int class_name_len;
        zend_bool autoload = 1;
@@ -1040,7 +1041,7 @@ ZEND_FUNCTION(class_exists)
        if (!autoload) {
                lc_name = zend_u_str_case_fold(type, class_name, class_name_len, 1, &lc_name_len);
                found = zend_u_hash_find(EG(class_table), type, lc_name, lc_name_len+1, (void **) &ce);
-               efree(lc_name);
+               efree(lc_name.v);
                RETURN_BOOL(found == SUCCESS && !((*ce)->ce_flags & ZEND_ACC_INTERFACE));
        }
 
@@ -1057,7 +1058,7 @@ ZEND_FUNCTION(class_exists)
 ZEND_FUNCTION(interface_exists)
 {
        unsigned int lc_name_len;
-       void *iface_name, *lc_name;
+       zstr iface_name, lc_name;
        zend_class_entry **ce;
        int iface_name_len;
        zend_uchar type;
@@ -1071,7 +1072,7 @@ ZEND_FUNCTION(interface_exists)
        if (!autoload) {
                lc_name = zend_u_str_case_fold(type, iface_name, iface_name_len, 1, &lc_name_len);
                found = zend_u_hash_find(EG(class_table), type, lc_name, lc_name_len+1, (void **) &ce);
-               efree(lc_name);
+               efree(lc_name.v);
                RETURN_BOOL(found == SUCCESS && (*ce)->ce_flags & ZEND_ACC_INTERFACE);
        }
 
@@ -1091,7 +1092,7 @@ ZEND_FUNCTION(function_exists)
        zval **function_name;
        zend_function *func;
        unsigned int lcname_len;
-       char *lcname;
+       zstr lcname;
        zend_bool retval;
 
        if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &function_name)==FAILURE) {
@@ -1102,7 +1103,7 @@ ZEND_FUNCTION(function_exists)
 
        retval = (zend_u_hash_find(EG(function_table), Z_TYPE_PP(function_name), lcname, lcname_len+1, (void **)&func) == SUCCESS);
 
-       efree(lcname);
+       efree(lcname.v);
 
        /*
         * A bit of a hack, but not a bad one: we see if the handler of the function
@@ -1152,7 +1153,7 @@ ZEND_FUNCTION(crash)
    Returns an array with the file names that were include_once()'d */
 ZEND_FUNCTION(get_included_files)
 {
-       char *entry;
+       zstr entry;
        if (ZEND_NUM_ARGS() != 0) {
                ZEND_WRONG_PARAM_COUNT();
        }
@@ -1160,7 +1161,7 @@ ZEND_FUNCTION(get_included_files)
        array_init(return_value);
        zend_hash_internal_pointer_reset(&EG(included_files));
        while (zend_hash_get_current_key(&EG(included_files), &entry, NULL, 0) == HASH_KEY_IS_STRING) {
-               add_next_index_rt_string(return_value, entry, 1);
+               add_next_index_rt_string(return_value, entry.s, 1);
                zend_hash_move_forward(&EG(included_files));
        }
 }
@@ -1350,8 +1351,8 @@ static int copy_class_or_interface_name(zend_class_entry **pce, int num_args, va
        TSRMLS_FETCH();
 
        if ((hash_key->nKeyLength==0 ||
-            (hash_key->type == IS_UNICODE && hash_key->u.unicode[0] != 0) ||
-            (hash_key->type == IS_STRING && hash_key->u.string[0] != 0))
+            (hash_key->type == IS_UNICODE && hash_key->arKey.u[0] != 0) ||
+            (hash_key->type == IS_STRING && hash_key->arKey.s[0] != 0))
                && (comply_mask == (ce->ce_flags & mask))) {
                add_next_index_textl(array, ce->name, ce->name_length, 1);
        }
@@ -1398,22 +1399,22 @@ static int copy_function_name(zend_function *func, int num_args, va_list args, z
             *user_ar     = va_arg(args, zval *);
 
        if (hash_key->nKeyLength == 0 ||
-           (hash_key->type == IS_UNICODE && hash_key->u.unicode[0] == 0) ||
-           (hash_key->type == IS_STRING && hash_key->u.unicode[0] == 0)) {
+           (hash_key->type == IS_UNICODE && hash_key->arKey.u[0] == 0) ||
+           (hash_key->type == IS_STRING && hash_key->arKey.s[0] == 0)) {
                return 0;
        }
 
        if (func->type == ZEND_INTERNAL_FUNCTION) {
                if (hash_key->type == IS_STRING) {
-                       add_next_index_stringl(internal_ar, hash_key->u.string, hash_key->nKeyLength-1, 1);
+                       add_next_index_stringl(internal_ar, hash_key->arKey.s, hash_key->nKeyLength-1, 1);
                } else {
-                       add_next_index_unicodel(internal_ar, hash_key->u.unicode, hash_key->nKeyLength-1, 1);
+                       add_next_index_unicodel(internal_ar, hash_key->arKey.u, hash_key->nKeyLength-1, 1);
                }
        } else if (func->type == ZEND_USER_FUNCTION) {
                if (hash_key->type == IS_STRING) {
-                       add_next_index_stringl(user_ar, hash_key->u.string, hash_key->nKeyLength-1, 1);
+                       add_next_index_stringl(user_ar, hash_key->arKey.s, hash_key->nKeyLength-1, 1);
                } else {
-                       add_next_index_unicodel(user_ar, hash_key->u.unicode, hash_key->nKeyLength-1, 1);
+                       add_next_index_unicodel(user_ar, hash_key->arKey.u, hash_key->nKeyLength-1, 1);
                }
        }
 
@@ -1662,7 +1663,8 @@ ZEND_FUNCTION(get_defined_constants)
                        zval_copy_ctor(const_val);
                        INIT_PZVAL(const_val);
 
-                       add_assoc_zval_ex(modules[module_number], val->name, val->name_len, const_val);
+                       /* FIXME: Unicode support??? */
+                       add_assoc_zval_ex(modules[module_number], val->name.s, val->name_len, const_val);
 bad_module_id:
                        zend_hash_move_forward_ex(EG(zend_constants), &pos);
                }
@@ -1723,9 +1725,9 @@ ZEND_FUNCTION(debug_print_backtrace)
 {
        zend_execute_data *ptr, *skip;
        int lineno;
-       char *function_name;
+       zstr function_name;
        char *filename;
-       char *class_name = NULL;
+       zstr class_name;
        char *call_type;
        char *include_filename = NULL;
        zval *arg_array = NULL;
@@ -1774,10 +1776,11 @@ ZEND_FUNCTION(debug_print_backtrace)
        array_init(return_value);
 
        while (ptr) {
-               char *free_class_name = NULL;
+               zstr free_class_name = (zstr)NULL;
                int     function_name_string = 1;
 
-               class_name = call_type = NULL;
+               class_name = (zstr)NULL;
+               call_type = NULL;
                arg_array = NULL;
 
                skip = ptr;
@@ -1801,7 +1804,7 @@ ZEND_FUNCTION(debug_print_backtrace)
 
                function_name = ptr->function_state.function->common.function_name;
 
-               if (function_name) {
+               if (function_name.v) {
                        function_name_string = !UG(unicode);
                        if (ptr->object) {
                                if (ptr->function_state.function->common.scope) {
@@ -1821,7 +1824,7 @@ ZEND_FUNCTION(debug_print_backtrace)
                                class_name = ptr->function_state.function->common.scope->name;
                                call_type = "::";
                        } else {
-                               class_name = NULL;
+                               class_name = (zstr)NULL;
                                call_type = NULL;
                        }
                        if ((! ptr->opline) || ((ptr->opline->opcode == ZEND_DO_FCALL_BY_NAME) || (ptr->opline->opcode == ZEND_DO_FCALL))) {
@@ -1836,30 +1839,30 @@ ZEND_FUNCTION(debug_print_backtrace)
 
                        if (!ptr->opline || ptr->opline->opcode != ZEND_INCLUDE_OR_EVAL) {
                                /* can happen when calling eval from a custom sapi */
-                               function_name = "unknown";
+                               function_name.s = "unknown";
                                build_filename_arg = 0;
                        } else
                        switch (Z_LVAL(ptr->opline->op2.u.constant)) {
                                case ZEND_EVAL:
-                                       function_name = "eval";
+                                       function_name.s = "eval";
                                        build_filename_arg = 0;
                                        break;
                                case ZEND_INCLUDE:
-                                       function_name = "include";
+                                       function_name.s = "include";
                                        break;
                                case ZEND_REQUIRE:
-                                       function_name = "require";
+                                       function_name.s = "require";
                                        break;
                                case ZEND_INCLUDE_ONCE:
-                                       function_name = "include_once";
+                                       function_name.s = "include_once";
                                        break;
                                case ZEND_REQUIRE_ONCE:
-                                       function_name = "require_once";
+                                       function_name.s = "require_once";
                                        break;
                                default:
                                        /* this can actually happen if you use debug_backtrace() in your error_handler and
                                         * you're in the top-scope */
-                                       function_name = "unknown";
+                                       function_name.s = "unknown";
                                        build_filename_arg = 0;
                                        break;
                        }
@@ -1872,18 +1875,18 @@ ZEND_FUNCTION(debug_print_backtrace)
                        call_type = NULL;
                }
                zend_printf("#%-2d ", indent);
-               if (class_name) {
+               if (class_name.v) {
                        if (UG(unicode)) {
-                               zend_printf("%r", class_name);
+                               zend_printf("%r", class_name.u);
                        } else {
-                               ZEND_PUTS(class_name);
+                               ZEND_PUTS(class_name.s);
                        }
                        ZEND_PUTS(call_type);
                }
                if (function_name_string) {
-                       zend_printf("%s(", function_name?function_name:"main");
+                       zend_printf("%s(", function_name.s?function_name.s:"main");
                } else {
-                       zend_printf("%r(", function_name);
+                       zend_printf("%r(", function_name.u);
                }
                if (arg_array) {
                        debug_print_backtrace_args(arg_array TSRMLS_CC);
@@ -1893,8 +1896,8 @@ ZEND_FUNCTION(debug_print_backtrace)
                include_filename = filename;
                ptr = skip->prev_execute_data;
                ++indent;
-               if (free_class_name) {
-                       efree(free_class_name);
+               if (free_class_name.v) {
+                       efree(free_class_name.v);
                }
        }
 }
@@ -1905,9 +1908,9 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
 {
        zend_execute_data *ptr, *skip;
        int lineno;
-       char *function_name;
+       zstr function_name;
        char *filename;
-       char *class_name;
+       zstr class_name;
        char *include_filename = NULL;
        zval *stack_frame;
        void **cur_arg_pos = EG(argument_stack).top_element;
@@ -1987,7 +1990,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
 
                function_name = ptr->function_state.function->common.function_name;
 
-               if (function_name) {
+               if (function_name.v) {
                        add_assoc_text_ex(stack_frame, "function", sizeof("function"), function_name, 1);
 
                        if (ptr->object && Z_TYPE_P(ptr->object) == IS_OBJECT) {
@@ -2023,30 +2026,30 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
 
                        if (!ptr->opline || ptr->opline->opcode != ZEND_INCLUDE_OR_EVAL) {
                                /* can happen when calling eval from a custom sapi */
-                               function_name = "unknown";
+                               function_name.s = "unknown";
                                build_filename_arg = 0;
                        } else
                        switch (Z_LVAL(ptr->opline->op2.u.constant)) {
                                case ZEND_EVAL:
-                                       function_name = "eval";
+                                       function_name.s = "eval";
                                        build_filename_arg = 0;
                                        break;
                                case ZEND_INCLUDE:
-                                       function_name = "include";
+                                       function_name.s = "include";
                                        break;
                                case ZEND_REQUIRE:
-                                       function_name = "require";
+                                       function_name.s = "require";
                                        break;
                                case ZEND_INCLUDE_ONCE:
-                                       function_name = "include_once";
+                                       function_name.s = "include_once";
                                        break;
                                case ZEND_REQUIRE_ONCE:
-                                       function_name = "require_once";
+                                       function_name.s = "require_once";
                                        break;
                                default:
                                        /* this can actually happen if you use debug_backtrace() in your error_handler and
                                         * you're in the top-scope */
-                                       function_name = "unknown";
+                                       function_name.s = "unknown";
                                        build_filename_arg = 0;
                                        break;
                        }
@@ -2065,7 +2068,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
                                add_assoc_zval_ex(stack_frame, "args", sizeof("args"), arg_array);
                        }
 
-                       add_assoc_ascii_string_ex(stack_frame, "function", sizeof("function"), function_name, 1);
+                       add_assoc_ascii_string_ex(stack_frame, "function", sizeof("function"), function_name.s, 1);
                }
 
                add_next_index_zval(return_value, stack_frame);
index 9d4a267ee13ebb422a9dc29181a18b3d6657a2ff..5e3e3974450ce5e1fcfe03b55d4c82c73d85fff2 100644 (file)
@@ -40,9 +40,9 @@ static void zend_duplicate_property_info(zend_property_info *property_info)
        TSRMLS_FETCH();
 
        if (UG(unicode)) {
-               property_info->name = (char*)eustrndup((UChar*)property_info->name, property_info->name_length);
+               property_info->name.u = eustrndup(property_info->name.u, property_info->name_length);
        } else {
-               property_info->name = estrndup(property_info->name, property_info->name_length);
+               property_info->name.s = estrndup(property_info->name.s, property_info->name_length);
        }
        if (property_info->doc_comment) {
                property_info->doc_comment = estrndup(property_info->doc_comment, property_info->doc_comment_len);
@@ -55,16 +55,16 @@ static void zend_duplicate_property_info_internal(zend_property_info *property_i
        TSRMLS_FETCH();
 
        if (UG(unicode)) {
-               property_info->name = (char*)zend_ustrndup((UChar*)property_info->name, property_info->name_length);
+               property_info->name.u = zend_ustrndup(property_info->name.u, property_info->name_length);
        } else {
-               property_info->name = zend_strndup(property_info->name, property_info->name_length);
+               property_info->name.s = zend_strndup(property_info->name.s, property_info->name_length);
        }
 }
 
 
 static void zend_destroy_property_info(zend_property_info *property_info)
 {
-       efree(property_info->name);
+       efree(property_info->name.v);
        if (property_info->doc_comment) {
                efree(property_info->doc_comment);
        }
@@ -73,7 +73,7 @@ static void zend_destroy_property_info(zend_property_info *property_info)
 
 static void zend_destroy_property_info_internal(zend_property_info *property_info)
 {
-       free(property_info->name);
+       free(property_info->name.v);
 }
 
 static void build_runtime_defined_function_key(zval *result, zend_uchar type, char *name, int name_length TSRMLS_DC)
@@ -250,7 +250,7 @@ static zend_uint get_temporary_variable(zend_op_array *op_array)
        return (op_array->T)++ * sizeof(temp_variable);
 }
 
-static int lookup_cv(zend_op_array *op_array, zend_uchar type, void *name, int name_len)
+static int lookup_cv(zend_op_array *op_array, zend_uchar type, zstr name, int name_len)
 {
        int i = 0;
        ulong hash_value = zend_u_inline_hash_func(type, name, name_len+1);
@@ -258,8 +258,8 @@ static int lookup_cv(zend_op_array *op_array, zend_uchar type, void *name, int n
        while (i < op_array->last_var) {
                if (op_array->vars[i].hash_value == hash_value &&
                    op_array->vars[i].name_len == name_len &&
-                   !memcmp(op_array->vars[i].name, name, type==IS_UNICODE?UBYTES(name_len):name_len)) {
-                 efree(name);
+                   !memcmp(op_array->vars[i].name.v, name.v, type==IS_UNICODE?UBYTES(name_len):name_len)) {
+                 efree(name.v);
                  return i;
                }
                i++;
@@ -1090,12 +1090,12 @@ int zend_do_verify_access_types(znode *current_access_type, znode *new_modifier)
 void zend_do_begin_function_declaration(znode *function_token, znode *function_name, int is_method, int return_reference, znode *fn_flags_znode TSRMLS_DC)
 {
        zend_op_array op_array;
-       char *name = Z_UNIVAL(function_name->u.constant);
+       zstr name = Z_UNIVAL(function_name->u.constant);
        int name_len = Z_UNILEN(function_name->u.constant);
        int function_begin_line = function_token->u.opline_num;
        zend_uint fn_flags;
        unsigned int lcname_len;
-       char *lcname;
+       zstr lcname;
 
        if (is_method) {
                if (CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE) {
@@ -1109,7 +1109,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
                fn_flags = 0;
        }
        if ((fn_flags & ZEND_ACC_STATIC) && (fn_flags & ZEND_ACC_ABSTRACT) && !(CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE)) {
-               zend_error(E_COMPILE_ERROR, "Static function %v%s%R() cannot be abstract", is_method ? CG(active_class_entry)->name : "", is_method ? "::" : "", Z_TYPE(function_name->u.constant), Z_UNIVAL(function_name->u.constant));
+               zend_error(E_COMPILE_ERROR, "Static function %v%s%R() cannot be abstract", is_method ? CG(active_class_entry)->name : (zstr)EMPTY_STR, is_method ? "::" : "", Z_TYPE(function_name->u.constant), Z_UNIVAL(function_name->u.constant));
        }
 
        function_token->u.op_array = CG(active_op_array);
@@ -1128,7 +1128,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
        op_array.line_start = zend_get_compiled_lineno(TSRMLS_C);
 
        if (is_method) {
-               char *short_class_name = CG(active_class_entry)->name;
+               zstr short_class_name = CG(active_class_entry)->name;
                unsigned int short_class_name_length = CG(active_class_entry)->name_length;
 
                if (zend_u_hash_add(&CG(active_class_entry)->function_table, Z_TYPE(function_name->u.constant), lcname, lcname_len+1, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)) == FAILURE) {
@@ -1139,7 +1139,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
                                        && (child_op_array == parent_op_array)) {
                                zend_u_hash_update(&CG(active_class_entry)->function_table, Z_TYPE(function_name->u.constant), name, name_len+1, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array));
                        } else {
-                               efree(lcname);
+                               efree(lcname.v);
                                zend_error(E_COMPILE_ERROR, "Cannot redeclare %v::%R()", CG(active_class_entry)->name, Z_TYPE(function_name->u.constant), name);
                        }
                }
@@ -1156,7 +1156,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
                        short_class_name = zend_u_str_case_fold(UG(unicode)?IS_UNICODE:IS_STRING, CG(active_class_entry)->name, short_class_name_length, 0, &short_class_name_length);
                        /* Improve after RC: cache the lowercase class name */
 
-                       if ((short_class_name_length == name_len) && (!memcmp(short_class_name, lcname, UG(unicode)?UBYTES(lcname_len):lcname_len))) {
+                       if ((short_class_name_length == name_len) && (!memcmp(short_class_name.v, lcname.v, UG(unicode)?UBYTES(lcname_len):lcname_len))) {
                                if (CG(active_class_entry)->constructor) {
                                        zend_error(E_STRICT, "Redefining already defined constructor for class %v", CG(active_class_entry)->name);
                                } else {
@@ -1186,19 +1186,19 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
                        } else if (!(fn_flags & ZEND_ACC_STATIC)) {
                                CG(active_op_array)->fn_flags |= ZEND_ACC_ALLOW_STATIC;
                        }
-                       efree(short_class_name);
+                       efree(short_class_name.v);
                }
 
-               efree(lcname);
+               efree(lcname.v);
        } else {
                zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
 
                opline->opcode = ZEND_DECLARE_FUNCTION;
                opline->op1.op_type = IS_CONST;
-               build_runtime_defined_function_key(&opline->op1.u.constant, Z_TYPE(function_name->u.constant), lcname, lcname_len TSRMLS_CC);
+               build_runtime_defined_function_key(&opline->op1.u.constant, Z_TYPE(function_name->u.constant), lcname.s, lcname_len TSRMLS_CC);
                opline->op2.op_type = IS_CONST;
                Z_TYPE(opline->op2.u.constant) = Z_TYPE(function_name->u.constant);
-               Z_STRVAL(opline->op2.u.constant) = lcname;
+               Z_STRVAL(opline->op2.u.constant) = lcname.s;
                Z_STRLEN(opline->op2.u.constant) = lcname_len;
                opline->op2.u.constant.refcount = 1;
                opline->extended_value = ZEND_DECLARE_FUNCTION;
@@ -1256,7 +1256,7 @@ void zend_do_handle_exception(TSRMLS_D)
 void zend_do_end_function_declaration(znode *function_token TSRMLS_DC)
 {
        unsigned int lcname_len;
-       char *lcname;
+       zstr lcname;
        char lcname_buf[16];
        int name_len;
 
@@ -1275,22 +1275,22 @@ void zend_do_end_function_declaration(znode *function_token TSRMLS_DC)
                 * the beginning of the name speeds up the check process */
                if (UG(unicode)) {
                        utype = IS_UNICODE;
-                       name_len = u_strlen((UChar*)CG(active_op_array)->function_name);
+                       name_len = u_strlen(CG(active_op_array)->function_name.u);
                        lcname = zend_u_str_case_fold(utype, CG(active_op_array)->function_name, name_len, 0, &lcname_len);
                } else {
                        utype = IS_STRING;
-                       lcname_len = name_len = strlen(CG(active_op_array)->function_name);
-                       zend_str_tolower_copy(lcname_buf, CG(active_op_array)->function_name, MIN(name_len, sizeof(lcname_buf)-1));
+                       lcname_len = name_len = strlen(CG(active_op_array)->function_name.s);
+                       zend_str_tolower_copy(lcname_buf, CG(active_op_array)->function_name.s, MIN(name_len, sizeof(lcname_buf)-1));
                        lcname_buf[sizeof(lcname_buf)-1] = '\0'; /* zend_str_tolower_copy won't necessarily set the zero byte */
-                       lcname = lcname_buf;
+                       lcname.s = lcname_buf;
                }
                if (lcname_len == sizeof(ZEND_AUTOLOAD_FUNC_NAME) - 1 &&
                    ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME)-1) &&
                    CG(active_op_array)->num_args != 1) {
                        zend_error(E_COMPILE_ERROR, "%s() must take exactly 1 argument", ZEND_AUTOLOAD_FUNC_NAME);
                }
-               if (lcname != lcname_buf) {
-                       efree(lcname);
+               if (lcname.s != lcname_buf) {
+                       efree(lcname.s);
                }
        }
 
@@ -1304,15 +1304,15 @@ void zend_do_end_function_declaration(znode *function_token TSRMLS_DC)
 }
 
 
-static inline int ZEND_U_CASE_EQUAL(zend_uchar type, void *ustr, int ulen, char *str, int slen)
+static inline int ZEND_U_CASE_EQUAL(zend_uchar type, zstr ustr, int ulen, char *str, int slen)
 {
-       void* lcname;
+       zstr lcname;
        unsigned int lcname_len;
        int ret;
 
        lcname = zend_u_str_case_fold(type, ustr, ulen, 0, &lcname_len);
        ret = ZEND_U_EQUAL(type, lcname, lcname_len, str, slen);
-       efree(lcname);
+       efree(lcname.v);
        return ret;
 }
 
@@ -1335,9 +1335,9 @@ void zend_do_receive_arg(zend_uchar op, znode *var, znode *offset, znode *initia
        CG(active_op_array)->arg_info = erealloc(CG(active_op_array)->arg_info, sizeof(zend_arg_info)*(CG(active_op_array)->num_args));
        cur_arg_info = &CG(active_op_array)->arg_info[CG(active_op_array)->num_args-1];
        if (Z_TYPE(varname->u.constant) == IS_UNICODE) {
-               cur_arg_info->name = (char*)eustrndup(Z_USTRVAL(varname->u.constant), Z_USTRLEN(varname->u.constant));
+               cur_arg_info->name.u = eustrndup(Z_USTRVAL(varname->u.constant), Z_USTRLEN(varname->u.constant));
        } else {
-               cur_arg_info->name = estrndup(Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant));
+               cur_arg_info->name.s = estrndup(Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant));
        }
        cur_arg_info->name_len = Z_UNILEN(varname->u.constant);
        cur_arg_info->array_type_hint = 0;
@@ -1361,7 +1361,7 @@ void zend_do_receive_arg(zend_uchar op, znode *var, znode *offset, znode *initia
                        }
                } else {
                        cur_arg_info->array_type_hint = 1;
-                       cur_arg_info->class_name = NULL;
+                       cur_arg_info->class_name.v = NULL;
                        cur_arg_info->class_name_len = 0;
                        if (op == ZEND_RECV_INIT) {
                                if (Z_TYPE(initialization->u.constant) == IS_NULL ||
@@ -1375,7 +1375,7 @@ void zend_do_receive_arg(zend_uchar op, znode *var, znode *offset, znode *initia
                        }
                }
        } else {
-               cur_arg_info->class_name = NULL;
+               cur_arg_info->class_name.v = NULL;
                cur_arg_info->class_name_len = 0;
        }
        opline->result.u.EA.type |= EXT_TYPE_UNUSED;
@@ -1386,20 +1386,20 @@ int zend_do_begin_function_call(znode *function_name TSRMLS_DC)
 {
        zend_function *function;
        unsigned int lcname_len;
-       char *lcname;
+       zstr lcname;
 
        lcname = zend_u_str_case_fold(Z_TYPE(function_name->u.constant), Z_UNIVAL(function_name->u.constant), Z_UNILEN(function_name->u.constant), 0, &lcname_len);
        if (zend_u_hash_find(CG(function_table), Z_TYPE(function_name->u.constant), lcname, lcname_len+1, (void **) &function)==FAILURE) {
                zend_do_begin_dynamic_function_call(function_name TSRMLS_CC);
-               efree(lcname);
+               efree(lcname.v);
                return 1; /* Dynamic */
        }
-       efree(Z_UNIVAL(function_name->u.constant));
+       efree(Z_UNIVAL(function_name->u.constant).v);
        if (Z_TYPE(function_name->u.constant) == IS_UNICODE) {
-               Z_USTRVAL(function_name->u.constant) = (UChar *)lcname;
+               Z_USTRVAL(function_name->u.constant) = lcname.u;
                Z_USTRLEN(function_name->u.constant) = lcname_len;
        } else {
-               Z_STRVAL(function_name->u.constant) = lcname;
+               Z_STRVAL(function_name->u.constant) = lcname.s;
        }
 
        switch (function->type) {
@@ -1565,14 +1565,14 @@ void zend_do_begin_class_member_function_call(znode *class_name, znode *method_n
                } else {
                        if (Z_TYPE(opline->op2.u.constant) == IS_UNICODE) {
                                unsigned int lcname_len;
-                               UChar *lcname;
+                               zstr lcname;
 
                                lcname = zend_u_str_case_fold(Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant), Z_UNILEN(opline->op2.u.constant), 0, &lcname_len);
                                efree(Z_USTRVAL(opline->op2.u.constant));
-                               Z_USTRVAL(opline->op2.u.constant) = lcname;
+                               Z_USTRVAL(opline->op2.u.constant) = lcname.u;
                                Z_USTRLEN(opline->op2.u.constant) = lcname_len;
                        } else {
-                               zend_str_tolower(Z_UNIVAL(opline->op2.u.constant), Z_UNILEN(opline->op2.u.constant));
+                               zend_str_tolower(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant));
                        }
                }
        }
@@ -1633,7 +1633,7 @@ void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC)
                                        "allow_call_time_pass_reference to true in your INI file.  "
                                        "However, future versions may not support this any longer. ",
                                        (function_ptr && UG(unicode))?IS_UNICODE:IS_STRING,
-                                       (function_ptr?function_ptr->common.function_name:"[runtime function name]"));
+                                       (function_ptr?function_ptr->common.function_name.s:"[runtime function name]"));
        }
 
        if (function_ptr) {
@@ -1960,8 +1960,8 @@ static void do_inherit_parent_constructor(zend_class_entry *ce TSRMLS_DC)
        } else {
                /* Don't inherit the old style constructor if we already have the new style constructor */
                unsigned int lc_class_name_len, lc_parent_class_name_len;
-               char *lc_class_name;
-               char *lc_parent_class_name;
+               zstr lc_class_name;
+               zstr lc_parent_class_name;
                zend_uchar utype = UG(unicode)?IS_UNICODE:IS_STRING;
 
                        lc_class_name = zend_u_str_case_fold(utype, ce->name, ce->name_length, 0, &lc_class_name_len);
@@ -1974,9 +1974,9 @@ static void do_inherit_parent_constructor(zend_class_entry *ce TSRMLS_DC)
                                        function_add_ref(function TSRMLS_CC);
                                }
                        }
-                       efree(lc_parent_class_name);
+                       efree(lc_parent_class_name.v);
                }
-               efree(lc_class_name);
+               efree(lc_class_name.v);
        }
        ce->constructor = ce->parent->constructor;
 }
@@ -2038,12 +2038,13 @@ static zend_bool zend_do_perform_implementation_check(zend_function *fe, zend_fu
        }
 
        for (i=0; i < proto->common.num_args; i++) {
-               if (ZEND_LOG_XOR(fe->common.arg_info[i].class_name, proto->common.arg_info[i].class_name)) {
+               if (ZEND_LOG_XOR(fe->common.arg_info[i].class_name.v, proto->common.arg_info[i].class_name.v)) {
                        /* Only one has a type hint and the other one doesn't */
                        return 0;
                }
-               if (fe->common.arg_info[i].class_name
-                       && strcmp(fe->common.arg_info[i].class_name, proto->common.arg_info[i].class_name)!=0) {
+               if (fe->common.arg_info[i].class_name.v
+                       && strcmp(fe->common.arg_info[i].class_name.s, proto->common.arg_info[i].class_name.s)!=0) {
+                       /* FIXME: Unicode support??? */
                        return 0;
                }
                if (fe->common.arg_info[i].array_type_hint != proto->common.arg_info[i].array_type_hint) {
@@ -2073,7 +2074,7 @@ static zend_bool do_inherit_method_check(HashTable *child_function_table, zend_f
        zend_function *child;
        TSRMLS_FETCH();
 
-       if (zend_u_hash_quick_find(child_function_table, hash_key->type, hash_key->u.string, hash_key->nKeyLength, hash_key->h, (void **) &child)==FAILURE) {
+       if (zend_u_hash_quick_find(child_function_table, hash_key->type, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void **) &child)==FAILURE) {
                if (parent_flags & (ZEND_ACC_ABSTRACT)) {
                        child_ce->ce_flags |= ZEND_ACC_IMPLICIT_ABSTRACT_CLASS;
                }
@@ -2090,7 +2091,7 @@ static zend_bool do_inherit_method_check(HashTable *child_function_table, zend_f
        }
 
        if (parent_flags & ZEND_ACC_FINAL) {
-               zend_error(E_COMPILE_ERROR, "Cannot override final method %v::%v()", ZEND_FN_SCOPE_NAME(parent), child->common.function_name);
+               zend_error(E_COMPILE_ERROR, "Cannot override final method %v::%v()", ZEND_FN_SCOPE_NAME(parent), child->common.function_name.v);
        }
 
        child_flags     = child->common.fn_flags;
@@ -2153,10 +2154,10 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro
 
        utype = UG(unicode)?IS_UNICODE:IS_STRING;
        if (parent_info->flags & (ZEND_ACC_PRIVATE|ZEND_ACC_SHADOW)) {
-               if (zend_u_hash_quick_find(&ce->properties_info, hash_key->type, hash_key->u.string, hash_key->nKeyLength, hash_key->h, (void **) &child_info)==SUCCESS) {
+               if (zend_u_hash_quick_find(&ce->properties_info, hash_key->type, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void **) &child_info)==SUCCESS) {
                        child_info->flags |= ZEND_ACC_CHANGED;
                } else {
-                       zend_u_hash_quick_update(&ce->properties_info, hash_key->type, hash_key->u.string, hash_key->nKeyLength, hash_key->h, parent_info, sizeof(zend_property_info), (void **) &child_info);
+                       zend_u_hash_quick_update(&ce->properties_info, hash_key->type, hash_key->arKey, hash_key->nKeyLength, hash_key->h, parent_info, sizeof(zend_property_info), (void **) &child_info);
                        if(ce->type & ZEND_INTERNAL_CLASS) {
                                zend_duplicate_property_info_internal(child_info);
                        } else {
@@ -2168,11 +2169,11 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro
                return 0; /* don't copy access information to child */
        }
 
-       if (zend_u_hash_quick_find(&ce->properties_info, hash_key->type, hash_key->u.string, hash_key->nKeyLength, hash_key->h, (void **) &child_info)==SUCCESS) {
+       if (zend_u_hash_quick_find(&ce->properties_info, hash_key->type, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void **) &child_info)==SUCCESS) {
                if ((parent_info->flags & ZEND_ACC_STATIC) != (child_info->flags & ZEND_ACC_STATIC)) {
                        zend_error(E_COMPILE_ERROR, "Cannot redeclare %s%v::$%R as %s%v::$%R",
-                               (parent_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", parent_ce->name, hash_key->type, hash_key->u.string,
-                               (child_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", ce->name, hash_key->type, hash_key->u.string);
+                               (parent_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", parent_ce->name, hash_key->type, hash_key->arKey,
+                               (child_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", ce->name, hash_key->type, hash_key->arKey);
                }
 
                if(parent_info->flags & ZEND_ACC_CHANGED) {
@@ -2180,7 +2181,7 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro
                }
 
                if ((child_info->flags & ZEND_ACC_PPP_MASK) > (parent_info->flags & ZEND_ACC_PPP_MASK)) {
-                       zend_error(E_COMPILE_ERROR, "Access level to %v::$%R must be %s (as in class %v)%s", ce->name, hash_key->type, hash_key->u.string, zend_visibility_string(parent_info->flags), parent_ce->name, (parent_info->flags&ZEND_ACC_PUBLIC) ? "" : " or weaker");
+                       zend_error(E_COMPILE_ERROR, "Access level to %v::$%R must be %s (as in class %v)%s", ce->name, hash_key->type, hash_key->arKey, zend_visibility_string(parent_info->flags), parent_ce->name, (parent_info->flags&ZEND_ACC_PUBLIC) ? "" : " or weaker");
                } else if (child_info->flags & ZEND_ACC_IMPLICIT_PUBLIC) {
                        if (!(parent_info->flags & ZEND_ACC_IMPLICIT_PUBLIC)) {
                                /* Explicitly copy the default value from the parent (if it has one) */
@@ -2194,10 +2195,10 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro
                        }
                        return 1; /* Inherit from the parent */
                } else if ((child_info->flags & ZEND_ACC_PUBLIC) && (parent_info->flags & ZEND_ACC_PROTECTED)) {
-                       char *prot_name;
+                       zstr prot_name;
                        int prot_name_length;
 
-                       zend_u_mangle_property_name(&prot_name, &prot_name_length, utype, "*", 1, child_info->name, child_info->name_length, ce->type & ZEND_INTERNAL_CLASS);
+                       zend_u_mangle_property_name(&prot_name, &prot_name_length, utype, (zstr)"*", 1, child_info->name, child_info->name_length, ce->type & ZEND_INTERNAL_CLASS);
                        if (child_info->flags & ZEND_ACC_STATIC) {
                                zval **prop;
                                HashTable *ht;
@@ -2212,7 +2213,7 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro
                                        zval **new_prop;
                                        if (zend_u_hash_find(&ce->default_static_members, utype, child_info->name, child_info->name_length+1, (void**)&new_prop) == SUCCESS) {
                                                if (Z_TYPE_PP(new_prop) != IS_NULL && Z_TYPE_PP(prop) != IS_NULL) {
-                                                       char *prop_name, *tmp;
+                                                       zstr prop_name, tmp;
 
                                                        zend_u_unmangle_property_name(utype, child_info->name, &tmp, &prop_name);
                                                        zend_error(E_COMPILE_ERROR, "Cannot change initial value of property static protected %v::$%v in class %v",
@@ -2226,7 +2227,7 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro
                        } else {
                                zend_u_hash_del(&ce->default_properties, utype, prot_name, prot_name_length+1);
                        }
-                       pefree(prot_name, ce->type & ZEND_INTERNAL_CLASS);
+                       pefree(prot_name.v, ce->type & ZEND_INTERNAL_CLASS);
                }
                return 0;       /* Don't copy from parent */
        } else {
@@ -2332,9 +2333,9 @@ static zend_bool do_inherit_constant_check(HashTable *child_constants_table, zva
 {
        zval **old_constant;
 
-       if (zend_u_hash_quick_find(child_constants_table, hash_key->type, hash_key->u.string, hash_key->nKeyLength, hash_key->h, (void**)&old_constant) == SUCCESS) {
+       if (zend_u_hash_quick_find(child_constants_table, hash_key->type, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void**)&old_constant) == SUCCESS) {
          if (*old_constant != *parent_constant) {
-                       zend_error(E_COMPILE_ERROR, "Cannot inherit previously-inherited constant %R from interface %v", hash_key->type, hash_key->u.string, iface->name);
+                       zend_error(E_COMPILE_ERROR, "Cannot inherit previously-inherited constant %R from interface %v", hash_key->type, hash_key->arKey, iface->name);
                }
                return 0;
        }
@@ -2813,7 +2814,7 @@ void zend_do_begin_class_declaration(znode *class_token, znode *class_name, znod
        int doing_inheritance = 0;
        zend_class_entry *new_class_entry = emalloc(sizeof(zend_class_entry));
        unsigned int lcname_len;
-       char *lcname = zend_u_str_case_fold(Z_TYPE(class_name->u.constant), Z_UNIVAL(class_name->u.constant), Z_UNILEN(class_name->u.constant), 0, &lcname_len);
+       zstr lcname = zend_u_str_case_fold(Z_TYPE(class_name->u.constant), Z_UNIVAL(class_name->u.constant), Z_UNILEN(class_name->u.constant), 0, &lcname_len);
 
        if (CG(active_class_entry)) {
                zend_error(E_COMPILE_ERROR, "Class declarations may not be nested");
@@ -2824,7 +2825,7 @@ void zend_do_begin_class_declaration(znode *class_token, znode *class_name, znod
             ZEND_U_EQUAL(Z_TYPE(class_name->u.constant), lcname, lcname_len, "self", sizeof("self")-1)) ||
            (lcname_len == sizeof("parent")-1 &&
             ZEND_U_EQUAL(Z_TYPE(class_name->u.constant), lcname, lcname_len, "parent", sizeof("parent")-1))) {
-               efree(lcname);
+               efree(lcname.v);
                zend_error(E_COMPILE_ERROR, "Cannot use '%R' as class name as it is reserved", Z_TYPE(class_name->u.constant), Z_UNIVAL(class_name->u.constant));
        }
 
@@ -2853,7 +2854,7 @@ void zend_do_begin_class_declaration(znode *class_token, znode *class_name, znod
 
        opline = get_next_op(CG(active_op_array) TSRMLS_CC);
        opline->op1.op_type = IS_CONST;
-       build_runtime_defined_function_key(&opline->op1.u.constant, Z_TYPE(class_name->u.constant), lcname, lcname_len TSRMLS_CC);
+       build_runtime_defined_function_key(&opline->op1.u.constant, Z_TYPE(class_name->u.constant), lcname.s, lcname_len TSRMLS_CC);
 
        opline->op2.op_type = IS_CONST;
        Z_TYPE(opline->op2.u.constant) = Z_TYPE(class_name->u.constant);
@@ -2867,10 +2868,10 @@ void zend_do_begin_class_declaration(znode *class_token, znode *class_name, znod
        }
 
        if (Z_TYPE(opline->op2.u.constant) == IS_UNICODE) {
-               Z_USTRVAL(opline->op2.u.constant) = (UChar *)lcname;
+               Z_USTRVAL(opline->op2.u.constant) = lcname.u;
                Z_USTRLEN(opline->op2.u.constant) = lcname_len;
        } else {
-               Z_STRVAL(opline->op2.u.constant) = lcname;
+               Z_STRVAL(opline->op2.u.constant) = lcname.s;
                Z_STRLEN(opline->op2.u.constant) = lcname_len;
        }
 
@@ -2987,7 +2988,7 @@ ZEND_API void zend_mangle_property_name(char **dest, int *dest_length, char *src
        *dest_length = prop_name_length;
 }
 
-ZEND_API void zend_u_mangle_property_name(char **dest, int *dest_length, zend_uchar type, char *src1, int src1_length, char *src2, int src2_length, int internal)
+ZEND_API void zend_u_mangle_property_name(zstr *dest, int *dest_length, zend_uchar type, zstr src1, int src1_length, zstr src2, int src2_length, int internal)
 {
        if (type == IS_UNICODE) {
                UChar *prop_name;
@@ -2996,18 +2997,18 @@ ZEND_API void zend_u_mangle_property_name(char **dest, int *dest_length, zend_uc
                prop_name_length = 1 + src1_length + 1 + src2_length;
                prop_name = pemalloc(UBYTES(prop_name_length + 1), internal);
                prop_name[0] = 0;
-               if (src1_length == 1 && src1[0] == '*') {
+               if (src1_length == 1 && src1.s[0] == '*') {
                        prop_name[1] = '*';
                        prop_name[2] = 0;
                } else {
-                       memcpy(prop_name + 1, src1, UBYTES(src1_length+1));
+                       memcpy(prop_name + 1, src1.s, UBYTES(src1_length+1));
                }
-               memcpy(prop_name + 1 + src1_length + 1, src2, UBYTES(src2_length+1));
+               memcpy(prop_name + 1 + src1_length + 1, src2.s, UBYTES(src2_length+1));
 
-               *dest = (char*)prop_name;
+               dest->u = prop_name;
                *dest_length = prop_name_length;
        } else {
-               zend_mangle_property_name(dest, dest_length, src1, src1_length, src2, src2_length, internal);
+               zend_mangle_property_name(&dest->s, dest_length, src1.s, src1_length, src2.s, src2_length, internal);
        }
 }
 
@@ -3024,23 +3025,23 @@ ZEND_API void zend_unmangle_property_name(char *mangled_property, char **class_n
        *prop_name = (*class_name)+strlen(*class_name)+1;
 }
 
-ZEND_API void zend_u_unmangle_property_name(zend_uchar type, char *mangled_property, char **class_name, char **prop_name)
+ZEND_API void zend_u_unmangle_property_name(zend_uchar type, zstr mangled_property, zstr *class_name, zstr *prop_name)
 {
        if (type == IS_UNICODE) {
-               *prop_name = *class_name = NULL;
+               prop_name->v = class_name->v = NULL;
 
-               if (((UChar*)mangled_property)[0]!=0) {
+               if ((mangled_property.u)[0]!=0) {
                        *prop_name = mangled_property;
                        return;
                }
 
-               *class_name = mangled_property+UBYTES(1);
-               *prop_name = (*class_name)+UBYTES(u_strlen((UChar*)*class_name)+1);
-               if ((*(UChar**)class_name)[0] == '*') {
-                       *class_name = "*";
+               class_name->u = mangled_property.u + 1;
+               prop_name->u = class_name->u + u_strlen(class_name->u)+1;
+               if (class_name->u[0] == '*') {
+                       class_name->s = "*";
                }
        } else {
-               zend_unmangle_property_name(mangled_property, class_name, prop_name);
+               zend_unmangle_property_name(mangled_property.s, &class_name->s, &prop_name->s);
        }
 }
 
@@ -4128,7 +4129,7 @@ void zend_auto_global_dtor(zend_auto_global *auto_global)
 }
 
 
-zend_bool zend_u_is_auto_global(zend_uchar type, void *name, uint name_len TSRMLS_DC)
+zend_bool zend_u_is_auto_global(zend_uchar type, zstr name, uint name_len TSRMLS_DC)
 {
        zend_auto_global *auto_global;
 
@@ -4143,7 +4144,7 @@ zend_bool zend_u_is_auto_global(zend_uchar type, void *name, uint name_len TSRML
 
 zend_bool zend_is_auto_global(char *name, uint name_len TSRMLS_DC)
 {
-       return zend_u_is_auto_global(IS_STRING, name, name_len TSRMLS_CC);
+       return zend_u_is_auto_global(IS_STRING, (zstr)name, name_len TSRMLS_CC);
 }
 
 
@@ -4262,7 +4263,7 @@ ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify
 }
 
 
-int zend_get_class_fetch_type(zend_uchar type, char *class_name, uint class_name_len)
+int zend_get_class_fetch_type(zend_uchar type, zstr class_name, uint class_name_len)
 {
        if ((class_name_len == sizeof("self")-1) &&
            ZEND_U_EQUAL(type, class_name, class_name_len, "self", sizeof("self")-1)) {
@@ -4275,7 +4276,7 @@ int zend_get_class_fetch_type(zend_uchar type, char *class_name, uint class_name
        }
 }
 
-ZEND_API char* zend_get_compiled_variable_name(zend_op_array *op_array, zend_uint var, int* name_len)
+ZEND_API zstr zend_get_compiled_variable_name(zend_op_array *op_array, zend_uint var, int* name_len)
 {
        if (name_len) {
                *name_len = op_array->vars[var].name_len;
index d9a9d2f6c7abf1b087e03f8bd1a87bf21411b8f8..7fc564eda221a97b71b8d83b902795d8610a3749 100644 (file)
@@ -144,7 +144,7 @@ char *zend_visibility_string(zend_uint fn_flags);
 
 typedef struct _zend_property_info {
        zend_uint flags;
-       char *name;
+       zstr name;
        int name_length;
        ulong h;
        char *doc_comment;
@@ -153,9 +153,9 @@ typedef struct _zend_property_info {
 
 
 typedef struct _zend_arg_info {
-       char *name;
+       zstr name;
        zend_uint name_len;
-       char *class_name;
+       zstr class_name;
        zend_uint class_name_len;
        zend_bool array_type_hint;
        zend_bool allow_null;
@@ -165,7 +165,7 @@ typedef struct _zend_arg_info {
 } zend_arg_info;
 
 typedef struct _zend_compiled_variable {
-       char *name;
+       zstr name;
        int name_len;
        ulong hash_value;
 } zend_compiled_variable;
@@ -173,7 +173,7 @@ typedef struct _zend_compiled_variable {
 struct _zend_op_array {
        /* Common elements */
        zend_uchar type;
-       char *function_name;
+       zstr function_name;
        zend_class_entry *scope;
        zend_uint fn_flags;
        union _zend_function *prototype;
@@ -227,7 +227,7 @@ struct _zend_op_array {
 typedef struct _zend_internal_function {
        /* Common elements */
        zend_uchar type;
-       char *function_name;
+       zstr function_name;
        zend_class_entry *scope;
        zend_uint fn_flags;
        union _zend_function *prototype;
@@ -242,14 +242,14 @@ typedef struct _zend_internal_function {
        struct _zend_module_entry *module;
 } zend_internal_function;
 
-#define ZEND_FN_SCOPE_NAME(function)  ((function) && (function)->common.scope ? (function)->common.scope->name : (char*)EMPTY_STR)
+#define ZEND_FN_SCOPE_NAME(function)  ((function) && (function)->common.scope ? (function)->common.scope->name : (zstr)EMPTY_STR)
 
 typedef union _zend_function {
        zend_uchar type;        /* MUST be the first element of this struct! */
 
        struct {
                zend_uchar type;  /* never used */
-               char *function_name;
+               zstr function_name;
                zend_class_entry *scope;
                zend_uint fn_flags;
                union _zend_function *prototype;
@@ -335,10 +335,10 @@ ZEND_API char *zend_set_compiled_script_encoding(char *new_script_enc TSRMLS_DC)
 ZEND_API void zend_restore_compiled_script_encoding(char *original_script_enc TSRMLS_DC);
 ZEND_API char *zend_get_compiled_script_encoding(TSRMLS_D);
 
-ZEND_API char* zend_get_compiled_variable_name(zend_op_array *op_array, zend_uint var, int* name_len);
+ZEND_API zstr zend_get_compiled_variable_name(zend_op_array *op_array, zend_uint var, int* name_len);
 
 ZEND_API int zend_prepare_scanner_converters(const char *onetime_encoding, int run_time TSRMLS_DC);
-ZEND_API int32_t zend_convert_scanner_output(UChar **target, int32_t *target_len, const char *source, int32_t source_len, UErrorCode *status TSRMLS_DC);
+ZEND_API int zend_convert_scanner_output(UChar **target, int *target_len, const char *source, int source_len, UErrorCode *status TSRMLS_DC);
 int zend_unicode_yyinput(zend_file_handle *file_handle, char *buf, size_t len TSRMLS_DC);
 
 #ifdef ZTS
@@ -537,8 +537,8 @@ void zend_class_add_ref(zend_class_entry **ce);
 ZEND_API void zend_mangle_property_name(char **dest, int *dest_length, char *src1, int src1_length, char *src2, int src2_length, int internal);
 ZEND_API void zend_unmangle_property_name(char *mangled_property, char **prop_name, char **class_name);
 
-ZEND_API void zend_u_mangle_property_name(char **dest, int *dest_length, zend_uchar type, char *src1, int src1_length, char *src2, int src2_length, int internal);
-ZEND_API void zend_u_unmangle_property_name(zend_uchar type, char *mangled_property, char **prop_name, char **class_name);
+ZEND_API void zend_u_mangle_property_name(zstr *dest, int *dest_length, zend_uchar type, zstr src1, int src1_length, zstr src2, int src2_length, int internal);
+ZEND_API void zend_u_unmangle_property_name(zend_uchar type, zstr mangled_property, zstr *prop_name, zstr *class_name);
 
 
 #define ZEND_FUNCTION_DTOR (void (*)(void *)) zend_function_dtor
@@ -557,7 +557,7 @@ void zend_do_mark_last_catch(znode *first_catch, znode *last_additional_catch TS
 ZEND_API zend_bool zend_is_compiling(TSRMLS_D);
 ZEND_API char *zend_make_compiled_string_description(char *name TSRMLS_DC);
 ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify_handlers TSRMLS_DC);
-int zend_get_class_fetch_type(zend_uchar type, char *class_name, uint class_name_len);
+int zend_get_class_fetch_type(zend_uchar type, zstr class_name, uint class_name_len);
 
 typedef zend_bool (*zend_auto_global_callback)(char *name, uint name_len TSRMLS_DC);
 typedef struct _zend_auto_global {
@@ -570,7 +570,7 @@ typedef struct _zend_auto_global {
 void zend_auto_global_dtor(zend_auto_global *auto_global);
 ZEND_API int zend_register_auto_global(char *name, uint name_len, zend_auto_global_callback auto_global_callback TSRMLS_DC);
 ZEND_API zend_bool zend_is_auto_global(char *name, uint name_len TSRMLS_DC);
-ZEND_API zend_bool zend_u_is_auto_global(zend_uchar type, void *name, uint name_len TSRMLS_DC);
+ZEND_API zend_bool zend_u_is_auto_global(zend_uchar type, zstr name, uint name_len TSRMLS_DC);
 ZEND_API int zend_auto_global_disable_jit(char *varname, zend_uint varname_length TSRMLS_DC);
 
 int zendlex(znode *zendlval TSRMLS_DC);
index f4aaaae5d8215dab13f23323d3fe89c549fea46b..28684bfba015f1e1b0e5d81771fb1667c3d913ed 100644 (file)
@@ -32,13 +32,14 @@ void free_zend_constant(zend_constant *c)
        if (!(c->flags & CONST_PERSISTENT)) {
                zval_dtor(&c->value);
        }
-       free(c->name);
+       free(c->name.v);
 }
 
 
 void copy_zend_constant(zend_constant *c)
 {
-       c->name = zend_strndup(c->name, c->name_len - 1);
+       /* FIXME: Unicode support??? */
+       c->name.s = zend_strndup(c->name.s, c->name_len - 1);
        if (!(c->flags & CONST_PERSISTENT)) {
                zval_copy_ctor(&c->value);
        }
@@ -122,25 +123,25 @@ void zend_register_standard_constants(TSRMLS_D)
                c.flags = CONST_PERSISTENT;
                c.module_number = 0;
 
-               c.name = zend_strndup(ZEND_STRL("TRUE"));
+               c.name.s = zend_strndup(ZEND_STRL("TRUE"));
                c.name_len = sizeof("TRUE");
                Z_LVAL(c.value) = 1;
                Z_TYPE(c.value) = IS_BOOL;
                zend_register_constant(&c TSRMLS_CC);
 
-               c.name = zend_strndup(ZEND_STRL("FALSE"));
+               c.name.s = zend_strndup(ZEND_STRL("FALSE"));
                c.name_len = sizeof("FALSE");
                Z_LVAL(c.value) = 0;
                Z_TYPE(c.value) = IS_BOOL;
                zend_register_constant(&c TSRMLS_CC);
 
-               c.name = zend_strndup(ZEND_STRL("ZEND_THREAD_SAFE"));
+               c.name.s = zend_strndup(ZEND_STRL("ZEND_THREAD_SAFE"));
                c.name_len = sizeof("ZEND_THREAD_SAFE");
                Z_LVAL(c.value) = ZTS_V;
                Z_TYPE(c.value) = IS_BOOL;
                zend_register_constant(&c TSRMLS_CC);
 
-               c.name = zend_strndup(ZEND_STRL("NULL"));
+               c.name.s = zend_strndup(ZEND_STRL("NULL"));
                c.name_len = sizeof("NULL");
                Z_TYPE(c.value) = IS_NULL;
                zend_register_constant(&c TSRMLS_CC);
@@ -173,7 +174,7 @@ ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval,
        Z_TYPE(c.value) = IS_LONG;
        Z_LVAL(c.value) = lval;
        c.flags = flags;
-       c.name = zend_strndup(name, name_len-1);
+       c.name.s = zend_strndup(name, name_len-1);
        c.name_len = name_len;
        c.module_number = module_number;
        zend_register_constant(&c TSRMLS_CC);
@@ -187,7 +188,7 @@ ZEND_API void zend_register_double_constant(char *name, uint name_len, double dv
        Z_TYPE(c.value) = IS_DOUBLE;
        Z_DVAL(c.value) = dval;
        c.flags = flags;
-       c.name = zend_strndup(name, name_len-1);
+       c.name.s = zend_strndup(name, name_len-1);
        c.name_len = name_len;
        c.module_number = module_number;
        zend_register_constant(&c TSRMLS_CC);
@@ -202,7 +203,7 @@ ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *st
        Z_STRVAL(c.value) = strval;
        Z_STRLEN(c.value) = strlen;
        c.flags = flags;
-       c.name = zend_strndup(name, name_len-1);
+       c.name.s = zend_strndup(name, name_len-1);
        c.name_len = name_len;
        c.module_number = module_number;
        zend_register_constant(&c TSRMLS_CC);
@@ -215,22 +216,27 @@ ZEND_API void zend_register_string_constant(char *name, uint name_len, char *str
 }
 
 
-ZEND_API int zend_u_get_constant(zend_uchar type, void *name, uint name_len, zval *result TSRMLS_DC)
+ZEND_API int zend_u_get_constant(zend_uchar type, zstr name, uint name_len, zval *result TSRMLS_DC)
 {
        zend_constant *c;
        int retval = 1;
-       char *lookup_name;
-       char *colon;
+       zstr lookup_name;
+       zstr colon;
 
-       if ((UG(unicode) && (colon = (char*)u_memchr((UChar*)name, ':', name_len)) && ((UChar*)colon)[1] == ':') ||
-           (!UG(unicode) && (colon = memchr(name, ':', name_len)) && colon[1] == ':')) {
+       if ((UG(unicode) && (colon.u = u_memchr(name.u, ':', name_len)) && colon.u[1] == ':') ||
+           (!UG(unicode) && (colon.s = memchr(name.s, ':', name_len)) && colon.s[1] == ':')) {
                /* class constant */
                zend_class_entry **ce = NULL, *scope;
-               int class_name_len = UG(unicode)?((colon-(char*)name)/sizeof(UChar)):colon-(char*)name;
+               int class_name_len = UG(unicode)?colon.u-name.u:colon.s-name.s;
                int const_name_len = name_len - class_name_len - 2;
-               char *constant_name = colon + (UG(unicode)?UBYTES(2):2);
+               zstr constant_name, class_name;
                zval **ret_constant;
-               char *class_name;
+
+               if (UG(unicode)) {
+                       constant_name.u = colon.u + 2;
+               } else {
+                       constant_name.s = colon.s + 2;
+               }
 
                if (EG(in_execution)) {
                        scope = EG(scope);
@@ -239,9 +245,9 @@ ZEND_API int zend_u_get_constant(zend_uchar type, void *name, uint name_len, zva
                }
 
                if (UG(unicode)) {
-                       class_name = (char*)eustrndup((UChar*)name, class_name_len);
+                       class_name.u = eustrndup(name.u, class_name_len);
                } else {
-                       class_name = estrndup(name, class_name_len);
+                       class_name.s = estrndup(name.s, class_name_len);
                }
 
                if (class_name_len == sizeof("self")-1 &&
@@ -266,7 +272,7 @@ ZEND_API int zend_u_get_constant(zend_uchar type, void *name, uint name_len, zva
                                retval = 0;
                        }
                }
-               efree(class_name);
+               efree(class_name.v);
 
                if (retval && ce) {
                        if (zend_u_hash_find(&((*ce)->constants_table), type, constant_name, const_name_len+1, (void **) &ret_constant) != SUCCESS) {
@@ -291,13 +297,13 @@ ZEND_API int zend_u_get_constant(zend_uchar type, void *name, uint name_len, zva
                lookup_name = zend_u_str_case_fold(type, name, name_len, 1, &lookup_name_len);
 
                if (zend_u_hash_find(EG(zend_constants), type, lookup_name, lookup_name_len+1, (void **) &c)==SUCCESS) {
-                       if ((c->flags & CONST_CS) && memcmp(c->name, name, UG(unicode)?UBYTES(name_len):name_len)!=0) {
+                       if ((c->flags & CONST_CS) && memcmp(c->name.v, name.v, UG(unicode)?UBYTES(name_len):name_len)!=0) {
                                retval=0;
                        }
                } else {
                        retval=0;
                }
-               efree(lookup_name);
+               efree(lookup_name.v);
        }
 
        if (retval) {
@@ -312,14 +318,14 @@ ZEND_API int zend_u_get_constant(zend_uchar type, void *name, uint name_len, zva
 
 ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC)
 {
-       return zend_u_get_constant(IS_STRING, name, name_len, result TSRMLS_CC);
+       return zend_u_get_constant(IS_STRING, (zstr)name, name_len, result TSRMLS_CC);
 }
 
 ZEND_API int zend_u_register_constant(zend_uchar type, zend_constant *c TSRMLS_DC)
 {
        unsigned int  lookup_name_len;
-       char *lookup_name = NULL;
-       char *name;
+       zstr lookup_name;
+       zstr name;
        int ret = SUCCESS;
 
 #if 0
@@ -333,18 +339,19 @@ ZEND_API int zend_u_register_constant(zend_uchar type, zend_constant *c TSRMLS_D
        } else {
                lookup_name_len = c->name_len;
                name = c->name;
+               lookup_name.v = NULL;
        }
 
        if (zend_u_hash_add(EG(zend_constants), type, name, lookup_name_len, (void *) c, sizeof(zend_constant), NULL)==FAILURE) {
                zend_error(E_NOTICE,"Constant %R already defined", type, name);
-               free(c->name);
+               free(c->name.v);
                if (!(c->flags & CONST_PERSISTENT)) {
                        zval_dtor(&c->value);
                }
                ret = FAILURE;
        }
-       if (lookup_name) {
-               efree(lookup_name);
+       if (lookup_name.v) {
+               efree(lookup_name.v);
        }
        return ret;
 }
index 9c9e8168b0ab6f908909c1e8b5a83f202daef560..516241bfad578a58a5d252affc0390a49021c333 100644 (file)
@@ -32,7 +32,7 @@
 typedef struct _zend_constant {
        zval value;
        int flags;
-       char *name;
+       zstr name;
        uint name_len;
        int module_number;
 } zend_constant;
@@ -55,7 +55,7 @@ int zend_shutdown_constants(TSRMLS_D);
 void zend_register_standard_constants(TSRMLS_D);
 void clean_non_persistent_constants(TSRMLS_D);
 ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC);
-ZEND_API int zend_u_get_constant(zend_uchar type, void *name, uint name_len, zval *result TSRMLS_DC);
+ZEND_API int zend_u_get_constant(zend_uchar type, zstr name, uint name_len, zval *result TSRMLS_DC);
 ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval, int flags, int module_number TSRMLS_DC);
 ZEND_API void zend_register_double_constant(char *name, uint name_len, double dval, int flags, int module_number TSRMLS_DC);
 ZEND_API void zend_register_string_constant(char *name, uint name_len, char *strval, int flags, int module_number TSRMLS_DC);
index 59cad0b0f77e6d66b75cb2a4deed210df2e6a5f7..c94dd5bd1f37f825ec3ab8b3ba66389cfaba5fcc 100644 (file)
@@ -143,7 +143,7 @@ ZEND_METHOD(exception, __construct)
                } else if (UG(unicode)) {
                        UErrorCode status = U_ZERO_ERROR;
                        UChar *u_str;
-                       int32_t u_len;
+                       int u_len;
 
                        zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, message, message_len, &status);
                        zend_update_property_unicodel(default_exception_ce, object, "message", sizeof("message")-1, u_str, u_len TSRMLS_CC);
@@ -180,9 +180,9 @@ ZEND_METHOD(error_exception, __construct)
                if (message_type == IS_UNICODE) {
                        zend_update_property_unicodel(default_exception_ce, object, "message", sizeof("message")-1, message, message_len TSRMLS_CC);
                } else if (UG(unicode)) {
-           UErrorCode status = U_ZERO_ERROR;
+                       UErrorCode status = U_ZERO_ERROR;
                        UChar *u_str;
-                       int32_t u_len;
+                       int u_len;
 
                        zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, message, message_len, &status);
                        zend_update_property_unicodel(default_exception_ce, object, "message", sizeof("message")-1, u_str, u_len TSRMLS_CC);
@@ -438,7 +438,7 @@ static int _build_trace_args(zval **arg, int num_args, va_list args, zend_hash_k
                        TRACE_APPEND_STR("Array, ");
                        break;
                case IS_OBJECT: {
-                       char *class_name;
+                       zstr class_name;
                        zend_uint class_name_len;
                        int dup;
                        TSRMLS_FETCH();
@@ -450,15 +450,15 @@ static int _build_trace_args(zval **arg, int num_args, va_list args, zend_hash_k
                        if (UG(unicode)) {
                                zval tmp;
 
-                               ZVAL_UNICODEL(&tmp, (UChar*)class_name, class_name_len, 1);
+                               ZVAL_UNICODEL(&tmp, class_name.u, class_name_len, 1);
                                convert_to_string_with_converter(&tmp, ZEND_U_CONVERTER(UG(output_encoding_conv)));
                                TRACE_APPEND_STRL(Z_STRVAL(tmp), Z_STRLEN(tmp));
                                zval_dtor(&tmp);
                        } else {
-                               TRACE_APPEND_STRL(class_name, class_name_len);
+                               TRACE_APPEND_STRL(class_name.s, class_name_len);
                        }
                        if(!dup) {
-                               efree(class_name);
+                               efree(class_name.v);
                        }
 
                        TRACE_APPEND_STR("), ");
@@ -760,7 +760,8 @@ ZEND_API void zend_exception_error(zval *exception TSRMLS_DC)
                        if (Z_TYPE_P(str) != IS_STRING) {
                                zend_error(E_WARNING, "%v::__toString() must return a string", ce_exception->name);
                        } else {
-                               zend_update_property_string(default_exception_ce, exception, "string", sizeof("string")-1, EG(exception) ? ce_exception->name : Z_STRVAL_P(str) TSRMLS_CC);
+                               /* FIXME: Unicode support??? */
+                               zend_update_property_string(default_exception_ce, exception, "string", sizeof("string")-1, EG(exception) ? ce_exception->name.s : Z_STRVAL_P(str) TSRMLS_CC);
                        }
                }
                zval_ptr_dtor(&str);
index 7852c55f761f22110d97fdc290832a2e1d15c61b..075b42a302ff064268844a1490f3d636591eeb6d 100644 (file)
@@ -474,7 +474,8 @@ static inline void zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zv
 {
        zend_arg_info *cur_arg_info;
        zend_execute_data *ptr = EG(current_execute_data)->prev_execute_data;
-       char *fclass, *fsep, *fname;
+       char *fsep;
+       zstr fclass, fname;
 
        if (!zf->common.arg_info
                || arg_num>zf->common.num_args) {
@@ -483,10 +484,10 @@ static inline void zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zv
 
        cur_arg_info = &zf->common.arg_info[arg_num-1];
        fname = zf->common.function_name;
-       fsep = zf->common.scope ? "::" : (char*)EMPTY_STR;
-       fclass = zf->common.scope ? zf->common.scope->name : (char*)EMPTY_STR;
+       fsep = zf->common.scope ? "::" : "";
+       fclass = zf->common.scope ? zf->common.scope->name : (zstr)EMPTY_STR;
 
-       if (cur_arg_info->class_name) {
+       if (cur_arg_info->class_name.v) {
                if (!arg) {
                        if (ptr && ptr->op_array) {
                                zend_error(E_RECOVERABLE_ERROR, "Argument %d passed to %v%s%v() must be an object of class %v, called in %s on line %d and defined", arg_num, fclass, fsep, fname, cur_arg_info->class_name, ptr->op_array->filename, ptr->opline->lineno);
@@ -599,7 +600,7 @@ static inline void zend_assign_to_object(znode *result, zval **object_ptr, znode
        /* separate our value if necessary */
        if (EG(ze1_compatibility_mode) && Z_TYPE_P(value) == IS_OBJECT) {
                zval *orig_value = value;
-               char *class_name;
+               zstr class_name;
                zend_uint class_name_len;
                int dup;
 
@@ -609,12 +610,12 @@ static inline void zend_assign_to_object(znode *result, zval **object_ptr, znode
                value->refcount = 0;
                dup = zend_get_object_classname(orig_value, &class_name, &class_name_len TSRMLS_CC);
                if (Z_OBJ_HANDLER_P(value, clone_obj) == NULL) {
-                       zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v",  class_name);
+                       zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v",  class_name.v);
                }
-               zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name);
+               zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name.v);
                Z_OBJVAL_P(value) = Z_OBJ_HANDLER_P(orig_value, clone_obj)(orig_value TSRMLS_CC);
                if (!dup) {
-                       efree(class_name);
+                       efree(class_name.v);
                }
        } else if (value_op->op_type == IS_TMP_VAR) {
                zval *orig_value = value;
@@ -812,14 +813,14 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2
        }
 
        if (EG(ze1_compatibility_mode) && Z_TYPE_P(value) == IS_OBJECT) {
-               char *class_name;
+               zstr class_name;
                zend_uint class_name_len;
                int dup;
 
                dup = zend_get_object_classname(value, &class_name, &class_name_len TSRMLS_CC);
 
                if (Z_OBJ_HANDLER_P(value, clone_obj) == NULL) {
-                       zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v",  class_name);
+                       zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v",  class_name.v);
                } else if (PZVAL_IS_REF(variable_ptr)) {
                        if (variable_ptr != value) {
                                zend_uint refcount = variable_ptr->refcount;
@@ -832,7 +833,7 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2
                                *variable_ptr = *value;
                                variable_ptr->refcount = refcount;
                                variable_ptr->is_ref = 1;
-                               zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name);
+                               zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name.v);
                                Z_OBJVAL_P(variable_ptr) = Z_OBJ_HANDLER_P(value, clone_obj)(value TSRMLS_CC);
                                if (type != IS_TMP_VAR) {
                                        value->refcount--;
@@ -851,13 +852,13 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2
                                }
                                *variable_ptr = *value;
                                INIT_PZVAL(variable_ptr);
-                               zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name);
+                               zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name.v);
                                Z_OBJVAL_P(variable_ptr) = Z_OBJ_HANDLER_P(value, clone_obj)(value TSRMLS_CC);
                                zval_ptr_dtor(&value);
                        }
                }
                if (!dup) {
-                       efree(class_name);
+                       efree(class_name.v);
                }
        } else if (PZVAL_IS_REF(variable_ptr)) {
                if (variable_ptr!=value) {
@@ -952,25 +953,25 @@ static inline void zend_receive(zval **variable_ptr_ptr, zval *value TSRMLS_DC)
        zval *variable_ptr = *variable_ptr_ptr;
 
        if (EG(ze1_compatibility_mode) && Z_TYPE_P(value) == IS_OBJECT) {
-               char *class_name;
+               zstr class_name;
                zend_uint class_name_len;
                int dup;
 
                dup = zend_get_object_classname(value, &class_name, &class_name_len TSRMLS_CC);
 
                if (Z_OBJ_HANDLER_P(value, clone_obj) == NULL) {
-                       zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v",  class_name);
+                       zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v",  class_name.v);
                } else {
                        variable_ptr->refcount--;
                        ALLOC_ZVAL(variable_ptr);
                        *variable_ptr_ptr = variable_ptr;
                        *variable_ptr = *value;
                        INIT_PZVAL(variable_ptr);
-                       zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name);
+                       zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name.v);
                        Z_OBJVAL_P(variable_ptr) = Z_OBJ_HANDLER_P(value, clone_obj)(value TSRMLS_CC);
                }
                if (!dup) {
-                       efree(class_name);
+                       efree(class_name.v);
                }
        } else {
                variable_ptr->refcount--;
@@ -1029,7 +1030,7 @@ static inline HashTable *zend_get_target_symbol_table(zend_op *opline, temp_vari
 static inline zval **zend_fetch_dimension_address_inner(HashTable *ht, zval *dim, int type TSRMLS_DC)
 {
        zval **retval;
-       char *offset_key;
+       zstr offset_key;
        int offset_key_length;
        zend_uchar ztype = Z_TYPE_P(dim);
        int free_offset = 0;
@@ -1037,7 +1038,7 @@ static inline zval **zend_fetch_dimension_address_inner(HashTable *ht, zval *dim
        switch (ztype) {
                case IS_NULL:
                        ztype = IS_STRING;
-                       offset_key = "";
+                       offset_key.s = "";
                        offset_key_length = 1;
                        goto fetch_string_dim;
                case IS_STRING:
@@ -1050,12 +1051,12 @@ fetch_string_dim:
                        if (UG(unicode) && ht == &EG(symbol_table) && ztype == IS_UNICODE) {
                                /* Identifier normalization */
                                UChar *norm;
-                               int32_t norm_len;
+                               int norm_len;
 
-                               if (!zend_normalize_identifier(&norm, &norm_len, (UChar*)offset_key, offset_key_length, 0)) {
+                               if (!zend_normalize_identifier(&norm, &norm_len, offset_key.u, offset_key_length, 0)) {
                                        zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key);
-                               } else if ((char*)norm != offset_key) {
-                                       offset_key = (char*)norm;
+                               } else if (norm != offset_key.u) {
+                                       offset_key.u = norm;
                                        offset_key_length = norm_len;
                                        free_offset = 1;
                                }
@@ -1082,7 +1083,7 @@ fetch_string_dim:
                                }
                        }
                        if (free_offset) {
-                               efree(offset_key);
+                               efree(offset_key.v);
                        }
                        break;
                case IS_RESOURCE:
index a91ff59d826224d79b0969cca24fa8c6f56d154a..ceef36dc757bfe0b0dcdc0d2524d21804898cb51 100644 (file)
@@ -65,12 +65,12 @@ static inline void safe_free_zval_ptr_rel(zval *p ZEND_FILE_LINE_DC ZEND_FILE_LI
        }
 }
 ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC);
-ZEND_API int zend_u_lookup_class(zend_uchar type, void *name, int name_length, zend_class_entry ***ce TSRMLS_DC);
-ZEND_API int zend_u_lookup_class_ex(zend_uchar type, void *name, int name_length, int use_autoload, zend_class_entry ***ce TSRMLS_DC);
+ZEND_API int zend_u_lookup_class(zend_uchar type, zstr name, int name_length, zend_class_entry ***ce TSRMLS_DC);
+ZEND_API int zend_u_lookup_class_ex(zend_uchar type, zstr name, int name_length, int use_autoload, zend_class_entry ***ce TSRMLS_DC);
 ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC);
 ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC);
-ZEND_API int zend_u_eval_string(zend_uchar type, void *str, zval *retval_ptr, char *string_name TSRMLS_DC);
-ZEND_API int zend_u_eval_string_ex(zend_uchar type, void *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC);
+ZEND_API int zend_u_eval_string(zend_uchar type, zstr str, zval *retval_ptr, char *string_name TSRMLS_DC);
+ZEND_API int zend_u_eval_string_ex(zend_uchar type, zstr str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC);
 
 static inline int i_zend_is_true(zval *op)
 {
@@ -175,8 +175,8 @@ void execute_new_code(TSRMLS_D);
 
 
 /* services */
-ZEND_API char *get_active_class_name(char **space TSRMLS_DC);
-ZEND_API char *get_active_function_name(TSRMLS_D);
+ZEND_API zstr get_active_class_name(char **space TSRMLS_DC);
+ZEND_API zstr get_active_function_name(TSRMLS_D);
 ZEND_API char *zend_get_executed_filename(TSRMLS_D);
 ZEND_API uint zend_get_executed_lineno(TSRMLS_D);
 ZEND_API zend_bool zend_is_executing(TSRMLS_D);
@@ -185,7 +185,7 @@ ZEND_API void zend_set_timeout(long seconds);
 ZEND_API void zend_unset_timeout(TSRMLS_D);
 ZEND_API void zend_timeout(int dummy);
 ZEND_API zend_class_entry *zend_fetch_class(char *class_name, uint class_name_len, int fetch_type TSRMLS_DC);
-ZEND_API zend_class_entry *zend_u_fetch_class(zend_uchar type, void *class_name, uint class_name_len, int fetch_type TSRMLS_DC);
+ZEND_API zend_class_entry *zend_u_fetch_class(zend_uchar type, zstr class_name, uint class_name_len, int fetch_type TSRMLS_DC);
 void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC);
 
 #ifdef ZEND_WIN32
@@ -203,7 +203,7 @@ void zend_shutdown_timeout_thread();
 /* The following tries to resolve the classname of a zval of type object.
  * Since it is slow it should be only used in error messages.
  */
-#define Z_OBJ_CLASS_NAME_P(zval) ((zval) && Z_TYPE_P(zval) == IS_OBJECT && Z_OBJ_HT_P(zval)->get_class_entry != NULL && Z_OBJ_HT_P(zval)->get_class_entry(zval TSRMLS_CC) ? Z_OBJ_HT_P(zval)->get_class_entry(zval TSRMLS_CC)->name : (char*)EMPTY_STR)
+#define Z_OBJ_CLASS_NAME_P(zval) ((zval) && Z_TYPE_P(zval) == IS_OBJECT && Z_OBJ_HT_P(zval)->get_class_entry != NULL && Z_OBJ_HT_P(zval)->get_class_entry(zval TSRMLS_CC) ? Z_OBJ_HT_P(zval)->get_class_entry(zval TSRMLS_CC)->name : (zstr)EMPTY_STR)
 
 ZEND_API zval** zend_get_compiled_variable_value(zend_execute_data *execute_data_ptr, zend_uint var);
 
index 9caad62b820b49bc96486ecad6117ca0ec2f261a..9ede95a1b8615b8167613d8d307fe4513af8e964 100644 (file)
@@ -78,7 +78,7 @@ static void zend_handle_sigsegv(int dummy)
                fprintf(stderr, "SIGSEGV caught on opcode %d on opline %d of %s() at %s:%d\n\n",
                                active_opline->opcode,
                                active_opline-EG(active_op_array)->opcodes,
-                               get_active_function_name(TSRMLS_C),
+                               get_active_function_name(TSRMLS_C).s,
                                zend_get_executed_filename(TSRMLS_C),
                                zend_get_executed_lineno(TSRMLS_C));
        }
@@ -308,13 +308,13 @@ void shutdown_executor(TSRMLS_D)
 
 
 /* return class name and "::" or "". */
-ZEND_API char *get_active_class_name(char **space TSRMLS_DC)
+ZEND_API zstr get_active_class_name(char **space TSRMLS_DC)
 {
        if (!zend_is_executing(TSRMLS_C)) {
                if (space) {
                        *space = "";
                }
-               return (char*)EMPTY_STR;
+               return (zstr)EMPTY_STR;
        }
        switch (EG(function_state_ptr)->function->type) {
                case ZEND_USER_FUNCTION:
@@ -325,30 +325,30 @@ ZEND_API char *get_active_class_name(char **space TSRMLS_DC)
                        if (space) {
                                *space = ce ? "::" : "";
                        }
-                       return ce ? ce->name : (char*)EMPTY_STR;
+                       return ce ? ce->name : (zstr)EMPTY_STR;
                }
                default:
                        if (space) {
                                *space = "";
                        }
-                       return (char*)EMPTY_STR;
+                       return (zstr)EMPTY_STR;
        }
 }
 
 
-ZEND_API char *get_active_function_name(TSRMLS_D)
+ZEND_API zstr get_active_function_name(TSRMLS_D)
 {
        if (!zend_is_executing(TSRMLS_C)) {
-               return NULL;
+               return (zstr)NULL;
        }
        switch (EG(function_state_ptr)->function->type) {
                case ZEND_USER_FUNCTION: {
-                               char *function_name = ((zend_op_array *) EG(function_state_ptr)->function)->function_name;
+                               zstr function_name = ((zend_op_array *) EG(function_state_ptr)->function)->function_name;
 
-                               if (function_name) {
+                               if (function_name.v) {
                                        return function_name;
                                } else {
-                                       return UG(unicode)?(char*)u_main:"main";
+                                       return UG(unicode)?(zstr)u_main:(zstr)"main";
                                }
                        }
                        break;
@@ -356,7 +356,7 @@ ZEND_API char *get_active_function_name(TSRMLS_D)
                        return ((zend_internal_function *) EG(function_state_ptr)->function)->function_name;
                        break;
                default:
-                       return NULL;
+                       return (zstr)NULL;
        }
 }
 
@@ -466,7 +466,7 @@ ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC)
                p->is_ref = is_ref;
        } else if (Z_TYPE_P(p) == IS_CONSTANT_ARRAY) {
                zval **element, *new_val;
-               char *str_index;
+               zstr str_index;
                uint str_index_len;
                ulong num_index;
 
@@ -495,7 +495,7 @@ ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC)
                        if (UG(unicode)) {
                                if (Z_TYPE(const_value) == IS_UNICODE &&
                                    Z_USTRLEN(const_value) == str_index_len-1 &&
-                                   !u_strncmp(Z_USTRVAL(const_value), (UChar*)str_index, str_index_len)) {
+                                   !u_strncmp(Z_USTRVAL(const_value), str_index.u, str_index_len)) {
                                        /* constant value is the same as its name */
                                        zval_dtor(&const_value);
                                        zend_hash_move_forward(Z_ARRVAL_P(p));
@@ -504,7 +504,7 @@ ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC)
                        } else {
                                if (Z_TYPE(const_value) == IS_STRING &&
                                    Z_STRLEN(const_value) == str_index_len-1 &&
-                                  !strncmp(Z_STRVAL(const_value), str_index, str_index_len)) {
+                                  !strncmp(Z_STRVAL(const_value), str_index.s, str_index_len)) {
                                        /* constant value is the same as its name */
                                        zval_dtor(&const_value);
                                        zend_hash_move_forward(Z_ARRVAL_P(p));
@@ -530,13 +530,13 @@ ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC)
                                        break;
                                case IS_BOOL:
                                case IS_LONG:
-                                       zend_hash_update_current_key(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL, 0, Z_LVAL(const_value));
+                                       zend_hash_update_current_key(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, (zstr)NULL, 0, Z_LVAL(const_value));
                                        break;
                                case IS_DOUBLE:
-                                       zend_hash_update_current_key(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL, 0, (long)Z_DVAL(const_value));
+                                       zend_hash_update_current_key(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, (zstr)NULL, 0, (long)Z_DVAL(const_value));
                                        break;
                                case IS_NULL:
-                                       zend_hash_update_current_key(Z_ARRVAL_P(p), HASH_KEY_IS_STRING, "", 1, 0);
+                                       zend_hash_update_current_key(Z_ARRVAL_P(p), HASH_KEY_IS_STRING, (zstr)EMPTY_STR, 1, 0);
                                        break;
                        }
                        zend_hash_move_forward(Z_ARRVAL_P(p));
@@ -614,7 +614,8 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
        char *old_func_name = NULL;
        unsigned int clen;
        int mlen, fname_len;
-       char *mname, *colon, *fname, *lcname;
+       char *mname, *colon;
+       zstr fname, lcname;
 
        if (EG(exception)) {
                return FAILURE; /* we would result in an instable executor otherwise */
@@ -748,7 +749,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
                }
 
                if (Z_TYPE_P(fci->function_name) == IS_UNICODE) {
-                       if ((colon = (char*)u_strstr((UChar*)Z_UNIVAL_P(fci->function_name), (UChar*)":\0:\0")) != NULL) {
+                       if ((colon = (char*)u_strstr(Z_USTRVAL_P(fci->function_name), (UChar*)":\0:\0")) != NULL) {
                                mlen = u_strlen((UChar*)(colon+4));
                                clen = Z_UNILEN_P(fci->function_name) - mlen - 2;
                                mname = colon + 4;
@@ -762,19 +763,20 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
                }
                if (colon != NULL) {
                        zend_class_entry **pce, *ce_child = NULL;
-                       if (zend_u_lookup_class(Z_TYPE_P(fci->function_name), Z_STRVAL_P(fci->function_name), clen, &pce TSRMLS_CC) == SUCCESS) {
+                       if (zend_u_lookup_class(Z_TYPE_P(fci->function_name), Z_UNIVAL_P(fci->function_name), clen, &pce TSRMLS_CC) == SUCCESS) {
                                ce_child = *pce;
                        } else {
                                lcname = zend_u_str_case_fold(Z_TYPE_P(fci->function_name), Z_UNIVAL_P(fci->function_name), clen, 0, &clen);
                                /* caution: lcname is not '\0' terminated */
                                if (calling_scope) {
-                                       if (clen == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self") - 1) == 0) {
+                                       /* FIXME: Unicode support??? */
+                                       if (clen == sizeof("self") - 1 && memcmp(lcname.s, "self", sizeof("self") - 1) == 0) {
                                                ce_child = EG(active_op_array) ? EG(active_op_array)->scope : NULL;
-                                       } else if (clen == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent") - 1) == 0 && EG(active_op_array)->scope) {
+                                       } else if (clen == sizeof("parent") - 1 && memcmp(lcname.s, "parent", sizeof("parent") - 1) == 0 && EG(active_op_array)->scope) {
                                                ce_child = EG(active_op_array) && EG(active_op_array)->scope ? EG(scope)->parent : NULL;
                                        }
                                }
-                               efree(lcname);
+                               efree(lcname.v);
                        }
                        if (!ce_child) {
                                zend_error(E_ERROR, "Cannot call method %R() or method does not exist", Z_TYPE_P(fci->function_name), Z_UNIVAL_P(fci->function_name));
@@ -783,10 +785,10 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
                        check_scope_or_static = calling_scope;
                        fci->function_table = &ce_child->function_table;
                        calling_scope = ce_child;
-                       fname = colon + (Z_TYPE_P(fci->function_name) == IS_UNICODE ? 4 : 2);
+                       fname.s = colon + (Z_TYPE_P(fci->function_name) == IS_UNICODE ? 4 : 2);
                        fname_len = mlen;
                } else {
-                       fname = Z_STRVAL_P(fci->function_name);
+                       fname.s = Z_STRVAL_P(fci->function_name);
                        fname_len = Z_STRLEN_P(fci->function_name);
                }
 
@@ -797,20 +799,20 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
                        EX(function_state).function =
                                Z_OBJ_HT_PP(fci->object_pp)->get_method(fci->object_pp, fname, fname_len TSRMLS_CC);
                        if (EX(function_state).function && calling_scope != EX(function_state).function->common.scope) {
-                               void *function_name_lc = zend_u_str_tolower_dup(Z_TYPE_P(fci->function_name), fname, fname_len);
+                               zstr function_name_lc = zend_u_str_tolower_dup(Z_TYPE_P(fci->function_name), fname, fname_len);
                                if (zend_u_hash_find(&calling_scope->function_table, Z_TYPE_P(fci->function_name), function_name_lc, fname_len+1, (void **) &EX(function_state).function)==FAILURE) {
-                                       efree(function_name_lc);
+                                       efree(function_name_lc.v);
                                        zend_error(E_ERROR, "Cannot call method %v::%R() or method does not exist", calling_scope->name, Z_TYPE_P(fci->function_name), fname);
                                }
-                               efree(function_name_lc);
+                               efree(function_name_lc.v);
                        }
                } else if (calling_scope) {
                        unsigned int lcname_len;
-                       char *lcname = zend_u_str_case_fold(Z_TYPE_P(fci->function_name), fname, fname_len, 1, &lcname_len);
+                       zstr lcname = zend_u_str_case_fold(Z_TYPE_P(fci->function_name), fname, fname_len, 1, &lcname_len);
 
                        EX(function_state).function =
                                zend_std_get_static_method(calling_scope, lcname, lcname_len TSRMLS_CC);
-                       efree(lcname);
+                       efree(lcname.v);
                        if (check_scope_or_static && EX(function_state).function
                        && !(EX(function_state).function->common.fn_flags & ZEND_ACC_STATIC)
                        && !instanceof_function(check_scope_or_static, calling_scope TSRMLS_CC)) {
@@ -819,12 +821,12 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
                        }
                } else {
                        unsigned int lcname_len;
-                       char *lcname = zend_u_str_case_fold(Z_TYPE_P(fci->function_name), fname, fname_len, 1, &lcname_len);
+                       zstr lcname = zend_u_str_case_fold(Z_TYPE_P(fci->function_name), fname, fname_len, 1, &lcname_len);
 
                        if (zend_u_hash_find(fci->function_table, Z_TYPE_P(fci->function_name), lcname, lcname_len+1, (void **) &EX(function_state).function)==FAILURE) {
                          EX(function_state).function = NULL;
                        }
-                       efree(lcname);
+                       efree(lcname.v);
                }
 
                if (EX(function_state).function == NULL) {
@@ -833,7 +835,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
                                EX(function_state).function = calling_scope->__call;
                                /* prepare params */
                                ALLOC_INIT_ZVAL(method_name);
-                               ZVAL_STRINGL(method_name, fname, fname_len, 0);
+                               ZVAL_STRINGL(method_name, fname.s, fname_len, 0);
 
                                ALLOC_INIT_ZVAL(params_array);
                                array_init(params_array);
@@ -867,7 +869,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
                }
                if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) {
                        zend_error(E_NOTICE, "Function %s%s%s() is deprecated",
-                               EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : "",
+                               EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name.s : "",
                                EX(function_state).function->common.scope ? "::" : "",
                                EX(function_state).function->common.function_name);
                }
@@ -1027,7 +1029,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
 }
 
 
-ZEND_API int zend_u_lookup_class_ex(zend_uchar type, void *name, int name_length, int use_autoload, zend_class_entry ***ce TSRMLS_DC)
+ZEND_API int zend_u_lookup_class_ex(zend_uchar type, zstr name, int name_length, int use_autoload, zend_class_entry ***ce TSRMLS_DC)
 {
        zval **args[1];
        zval autoload_function;
@@ -1035,20 +1037,20 @@ ZEND_API int zend_u_lookup_class_ex(zend_uchar type, void *name, int name_length
        zval *retval_ptr = NULL;
        int retval;
        unsigned int lc_name_len;
-       char *lc_name;
+       zstr lc_name;
        zval *exception;
        char dummy = 1;
        zend_fcall_info fcall_info;
        zend_fcall_info_cache fcall_cache;
 
-       if (name == NULL) {
+       if (name.v == NULL) {
                return FAILURE;
        }
 
        lc_name = zend_u_str_case_fold(type, name, name_length, 1, &lc_name_len);
 
        if (zend_u_hash_find(EG(class_table), type, lc_name, lc_name_len+1, (void **) ce) == SUCCESS) {
-               efree(lc_name);
+               efree(lc_name.v);
                return SUCCESS;
        }
 
@@ -1056,7 +1058,7 @@ ZEND_API int zend_u_lookup_class_ex(zend_uchar type, void *name, int name_length
         * (doesn't impact fuctionality of __autoload()
        */
        if (!use_autoload || zend_is_compiling(TSRMLS_C)) {
-               efree(lc_name);
+               efree(lc_name.v);
                return FAILURE;
        }
 
@@ -1066,7 +1068,7 @@ ZEND_API int zend_u_lookup_class_ex(zend_uchar type, void *name, int name_length
        }
 
        if (zend_u_hash_add(EG(in_autoload), type, lc_name, lc_name_len+1, (void**)&dummy, sizeof(char), NULL) == FAILURE) {
-               efree(lc_name);
+               efree(lc_name.v);
                return FAILURE;
        }
 
@@ -1074,11 +1076,7 @@ ZEND_API int zend_u_lookup_class_ex(zend_uchar type, void *name, int name_length
 
        ALLOC_ZVAL(class_name_ptr);
        INIT_PZVAL(class_name_ptr);
-       if (type == IS_UNICODE) {
-               ZVAL_UNICODEL(class_name_ptr, name, name_length, 1);
-       } else {
-               ZVAL_STRINGL(class_name_ptr, name, name_length, 1);
-       }
+       ZVAL_TEXTL(class_name_ptr, name, name_length, 1);
 
        args[0] = &class_name_ptr;
 
@@ -1112,12 +1110,12 @@ ZEND_API int zend_u_lookup_class_ex(zend_uchar type, void *name, int name_length
 
        if (retval == FAILURE) {
                EG(exception) = exception;
-               efree(lc_name);
+               efree(lc_name.v);
                return FAILURE;
        }
 
        if (EG(exception) && exception) {
-               efree(lc_name);
+               efree(lc_name.v);
                zend_error(E_ERROR, "Function %s(%R) threw an exception of type '%v'", ZEND_AUTOLOAD_FUNC_NAME, type, name, Z_OBJCE_P(EG(exception))->name);
                return FAILURE;
        }
@@ -1129,21 +1127,21 @@ ZEND_API int zend_u_lookup_class_ex(zend_uchar type, void *name, int name_length
        }
 
        retval = zend_u_hash_find(EG(class_table), type, lc_name, lc_name_len + 1, (void **) ce);
-       efree(lc_name);
+       efree(lc_name.v);
        return retval;
 }
 
-ZEND_API int zend_u_lookup_class(zend_uchar type, void *name, int name_length, zend_class_entry ***ce TSRMLS_DC)
+ZEND_API int zend_u_lookup_class(zend_uchar type, zstr name, int name_length, zend_class_entry ***ce TSRMLS_DC)
 {
        return zend_u_lookup_class_ex(type, name, name_length, 1, ce TSRMLS_CC);
 }
 
 ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC)
 {
-       return zend_u_lookup_class(IS_STRING, name, name_length, ce TSRMLS_CC);
+       return zend_u_lookup_class(IS_STRING, (zstr)name, name_length, ce TSRMLS_CC);
 }
 
-ZEND_API int zend_u_eval_string(zend_uchar type, void *string, zval *retval_ptr, char *string_name TSRMLS_DC)
+ZEND_API int zend_u_eval_string(zend_uchar type, zstr string, zval *retval_ptr, char *string_name TSRMLS_DC)
 {
        zval pv;
        zend_op_array *new_op_array;
@@ -1153,7 +1151,7 @@ ZEND_API int zend_u_eval_string(zend_uchar type, void *string, zval *retval_ptr,
        int retval;
 
        if (type == IS_UNICODE) {
-               UChar *str = (UChar*)string;
+               UChar *str = string.u;
 
                if (retval_ptr) {
                        Z_USTRLEN(pv) = u_strlen(str)+sizeof("return  ;")-1;
@@ -1166,7 +1164,7 @@ ZEND_API int zend_u_eval_string(zend_uchar type, void *string, zval *retval_ptr,
                        Z_USTRVAL(pv) = eustrndup(str, Z_USTRLEN(pv));
                }
        } else {
-               char *str = (char*)string;
+               char *str = string.s;
 
                if (retval_ptr) {
                        Z_STRLEN(pv) = strlen(str)+sizeof("return  ;")-1;
@@ -1228,14 +1226,14 @@ ZEND_API int zend_u_eval_string(zend_uchar type, void *string, zval *retval_ptr,
 
 ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC)
 {
-       return zend_u_eval_string(IS_STRING, str, retval_ptr, string_name TSRMLS_CC);
+       return zend_u_eval_string(IS_STRING, (zstr)str, retval_ptr, string_name TSRMLS_CC);
 }
 
-ZEND_API int zend_u_eval_string_ex(zend_uchar type, void *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC)
+ZEND_API int zend_u_eval_string_ex(zend_uchar type, zstr str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC)
 {
        int result;
 
-       result = zend_eval_string(str, retval_ptr, string_name TSRMLS_CC);
+       result = zend_u_eval_string(type, str, retval_ptr, string_name TSRMLS_CC);
        if (handle_exceptions && EG(exception)) {
                zend_exception_error(EG(exception) TSRMLS_CC);
                result = FAILURE;
@@ -1245,7 +1243,7 @@ ZEND_API int zend_u_eval_string_ex(zend_uchar type, void *str, zval *retval_ptr,
 
 ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC)
 {
-       return zend_u_eval_string_ex(IS_STRING, str, retval_ptr, string_name, handle_exceptions TSRMLS_CC);
+       return zend_u_eval_string_ex(IS_STRING, (zstr)str, retval_ptr, string_name, handle_exceptions TSRMLS_CC);
 }
 
 
@@ -1257,7 +1255,7 @@ void execute_new_code(TSRMLS_D)
 
        if (!CG(interactive)
                || CG(active_op_array)->backpatch_count>0
-               || CG(active_op_array)->function_name
+               || CG(active_op_array)->function_name.v
                || CG(active_op_array)->type!=ZEND_USER_FUNCTION) {
                return;
        }
@@ -1503,7 +1501,7 @@ void zend_unset_timeout(TSRMLS_D)
 }
 
 
-ZEND_API zend_class_entry *zend_u_fetch_class(zend_uchar type, void *class_name, uint class_name_len, int fetch_type TSRMLS_DC)
+ZEND_API zend_class_entry *zend_u_fetch_class(zend_uchar type, zstr class_name, uint class_name_len, int fetch_type TSRMLS_DC)
 {
        zend_class_entry **pce;
        int use_autoload = (fetch_type & ZEND_FETCH_CLASS_NO_AUTOLOAD) == 0;
@@ -1549,16 +1547,16 @@ check_fetch_type:
 
 zend_class_entry *zend_fetch_class(char *class_name, uint class_name_len, int fetch_type TSRMLS_DC)
 {
-       return zend_u_fetch_class(IS_STRING, class_name, class_name_len, fetch_type TSRMLS_CC);
+       return zend_u_fetch_class(IS_STRING, (zstr)class_name, class_name_len, fetch_type TSRMLS_CC);
 }
 
 
 #define MAX_ABSTRACT_INFO_CNT 3
 #define MAX_ABSTRACT_INFO_FMT "%v%s%v%s"
 #define DISPLAY_ABSTRACT_FN(idx) \
-       ai.afn[idx] ? ZEND_FN_SCOPE_NAME(ai.afn[idx]) : (char*)EMPTY_STR, \
+       ai.afn[idx] ? ZEND_FN_SCOPE_NAME(ai.afn[idx]) : (zstr)EMPTY_STR, \
        ai.afn[idx] ? "::" : "", \
-       ai.afn[idx] ? ai.afn[idx]->common.function_name : (char*)EMPTY_STR, \
+       ai.afn[idx] ? ai.afn[idx]->common.function_name : (zstr)EMPTY_STR, \
        ai.afn[idx] && ai.afn[idx+1] ? ", " : (ai.afn[idx] && ai.cnt > MAX_ABSTRACT_INFO_CNT ? ", ..." : "")
 
 typedef struct _zend_abstract_info {
@@ -1614,7 +1612,7 @@ ZEND_API void zend_reset_all_cv(HashTable *symbol_table TSRMLS_DC)
        }
 }
 
-ZEND_API int zend_u_delete_global_variable(zend_uchar type, void *name, int name_len TSRMLS_DC)
+ZEND_API int zend_u_delete_global_variable(zend_uchar type, zstr name, int name_len TSRMLS_DC)
 {
        zend_execute_data *ex;
        ulong hash_value = zend_u_inline_hash_func(type, name, name_len+1);
@@ -1626,7 +1624,7 @@ ZEND_API int zend_u_delete_global_variable(zend_uchar type, void *name, int name
                                for (i = 0; i < ex->op_array->last_var; i++) {
                                        if (ex->op_array->vars[i].hash_value == hash_value &&
                                            ex->op_array->vars[i].name_len == name_len &&
-                                           !memcmp(ex->op_array->vars[i].name, name, type==IS_UNICODE?UBYTES(name_len):name_len)) {
+                                           !memcmp(ex->op_array->vars[i].name.v, name.v, type==IS_UNICODE?UBYTES(name_len):name_len)) {
                                                ex->CVs[i] = NULL;
                                                break;
                                        }
@@ -1640,7 +1638,7 @@ ZEND_API int zend_u_delete_global_variable(zend_uchar type, void *name, int name
 
 ZEND_API int zend_delete_global_variable(char *name, int name_len TSRMLS_DC)
 {
-       return zend_u_delete_global_variable(IS_STRING, name, name_len TSRMLS_CC);
+       return zend_u_delete_global_variable(IS_STRING, (zstr)name, name_len TSRMLS_CC);
 }
 
 /*
index 501a2fef940cf5762545ba2402de8527ccfea6fe..2a5f371b18865043cd7affc02a36ea3ad5477e29 100644 (file)
        if (ht->unicode && type == IS_STRING) { \
                UErrorCode status = U_ZERO_ERROR; \
                UChar *u = NULL; \
-               int32_t u_len; \
+               int u_len; \
                TSRMLS_FETCH(); \
-               zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u, &u_len, (char*)arKey, nKeyLength-1, &status); \
+               zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u, &u_len, arKey.s, nKeyLength-1, &status); \
                if (U_FAILURE(status)) { \
                        /* UTODO: */ \
                } \
                type = IS_UNICODE; \
-               tmp = arKey = u; \
+               tmp = arKey.u = u; \
        }
 
 
@@ -114,14 +114,14 @@ static void _zend_is_inconsistent(HashTable *ht, char *file, int line)
 
 static int zend_hash_do_resize(HashTable *ht);
 
-ZEND_API ulong zend_u_hash_func(zend_uchar type, char *arKey, uint nKeyLength)
+ZEND_API ulong zend_u_hash_func(zend_uchar type, zstr arKey, uint nKeyLength)
 {
        return zend_u_inline_hash_func(type, arKey, nKeyLength);
 }
 
 ZEND_API ulong zend_hash_func(char *arKey, uint nKeyLength)
 {
-       return zend_u_hash_func(IS_STRING, arKey, nKeyLength);
+       return zend_u_hash_func(IS_STRING, (zstr)arKey, nKeyLength);
 }
 
 #define UPDATE_DATA(ht, p, pData, nDataSize)                                                                                   \
@@ -228,7 +228,7 @@ ZEND_API void zend_hash_set_apply_protection(HashTable *ht, zend_bool bApplyProt
 
 
 
-ZEND_API int _zend_u_hash_add_or_update(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC)
+ZEND_API int _zend_u_hash_add_or_update(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC)
 {
        ulong h;
        uint nIndex;
@@ -256,7 +256,7 @@ ZEND_API int _zend_u_hash_add_or_update(HashTable *ht, zend_uchar type, void *ar
                if ((p->h == h) &&
                    (p->key.type == type) &&
                    (p->nKeyLength == nKeyLength) &&
-                   !memcmp(&p->key.u, arKey, realKeyLength)) {
+                   !memcmp(p->key.arKey.s, arKey.s, realKeyLength)) {
                        if (flag & HASH_ADD) {
                                if (tmp) efree(tmp);
                                return FAILURE;
@@ -284,13 +284,13 @@ ZEND_API int _zend_u_hash_add_or_update(HashTable *ht, zend_uchar type, void *ar
                p = p->pNext;
        }
 
-       p = (Bucket *) pemalloc(sizeof(Bucket)-sizeof(p->key.u)+realKeyLength, ht->persistent);
+       p = (Bucket *) pemalloc(sizeof(Bucket)-sizeof(p->key.arKey)+realKeyLength, ht->persistent);
        if (!p) {
                if (tmp) efree(tmp);
                return FAILURE;
        }
        p->key.type = type;
-       memcpy(&p->key.u, arKey, realKeyLength);
+       memcpy(p->key.arKey.s, arKey.s, realKeyLength);
        p->nKeyLength = nKeyLength;
        INIT_DATA(ht, p, pData, nDataSize);
        p->h = h;
@@ -312,10 +312,10 @@ ZEND_API int _zend_u_hash_add_or_update(HashTable *ht, zend_uchar type, void *ar
 
 ZEND_API int _zend_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC)
 {
-       return _zend_u_hash_add_or_update(ht, IS_STRING, arKey, nKeyLength, pData, nDataSize, pDest, flag ZEND_FILE_LINE_CC);
+       return _zend_u_hash_add_or_update(ht, IS_STRING, (zstr)arKey, nKeyLength, pData, nDataSize, pDest, flag ZEND_FILE_LINE_CC);
 }
 
-ZEND_API int _zend_u_hash_quick_add_or_update(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC)
+ZEND_API int _zend_u_hash_quick_add_or_update(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC)
 {
        uint nIndex;
        Bucket *p;
@@ -341,7 +341,7 @@ ZEND_API int _zend_u_hash_quick_add_or_update(HashTable *ht, zend_uchar type, vo
                if ((p->h == h) &&
                    (p->key.type == type) &&
                    (p->nKeyLength == nKeyLength) &&
-                   !memcmp(&p->key.u, arKey, realKeyLength)) {
+                   !memcmp(p->key.arKey.s, arKey.s, realKeyLength)) {
                        if (flag & HASH_ADD) {
                                if (tmp) efree(tmp);
                                return FAILURE;
@@ -369,14 +369,14 @@ ZEND_API int _zend_u_hash_quick_add_or_update(HashTable *ht, zend_uchar type, vo
                p = p->pNext;
        }
 
-       p = (Bucket *) pemalloc(sizeof(Bucket)-sizeof(p->key.u)+realKeyLength, ht->persistent);
+       p = (Bucket *) pemalloc(sizeof(Bucket)-sizeof(p->key.arKey)+realKeyLength, ht->persistent);
        if (!p) {
                if (tmp) efree(tmp);
                return FAILURE;
        }
 
        p->key.type = type;
-       memcpy(&p->key.u, arKey, realKeyLength);
+       memcpy(p->key.arKey.s, arKey.s, realKeyLength);
        p->nKeyLength = nKeyLength;
        INIT_DATA(ht, p, pData, nDataSize);
        p->h = h;
@@ -400,10 +400,10 @@ ZEND_API int _zend_u_hash_quick_add_or_update(HashTable *ht, zend_uchar type, vo
 
 ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC)
 {
-       return _zend_u_hash_quick_add_or_update(ht, IS_STRING, arKey, nKeyLength, h, pData, nDataSize, pDest, flag ZEND_FILE_LINE_CC);
+       return _zend_u_hash_quick_add_or_update(ht, IS_STRING, (zstr)arKey, nKeyLength, h, pData, nDataSize, pDest, flag ZEND_FILE_LINE_CC);
 }
 
-ZEND_API int zend_u_hash_add_empty_element(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength)
+ZEND_API int zend_u_hash_add_empty_element(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength)
 {
        void *dummy = (void *) 1;
 
@@ -414,7 +414,7 @@ ZEND_API int zend_hash_add_empty_element(HashTable *ht, char *arKey, uint nKeyLe
 {
        void *dummy = (void *) 1;
 
-       return zend_u_hash_add(ht, IS_STRING, arKey, nKeyLength, &dummy, sizeof(void *), NULL);
+       return zend_u_hash_add(ht, IS_STRING, (zstr)arKey, nKeyLength, &dummy, sizeof(void *), NULL);
 }
 
 
@@ -459,7 +459,7 @@ ZEND_API int _zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void
                }
                p = p->pNext;
        }
-       p = (Bucket *) pemalloc_rel(sizeof(Bucket) - sizeof(p->key.u), ht->persistent);
+       p = (Bucket *) pemalloc_rel(sizeof(Bucket) - sizeof(p->key.arKey), ht->persistent);
        if (!p) {
                return FAILURE;
        }
@@ -528,12 +528,12 @@ ZEND_API int zend_hash_rehash(HashTable *ht)
        return SUCCESS;
 }
 
-ZEND_API int zend_u_hash_del_key_or_index(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, ulong h, int flag)
+ZEND_API int zend_u_hash_del_key_or_index(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, ulong h, int flag)
 {
        uint nIndex;
        Bucket *p;
        void *tmp = NULL;
-       uint realKeyLength;
+       uint realKeyLength = 0;
 
        IS_CONSISTENT(ht);
 
@@ -550,7 +550,7 @@ ZEND_API int zend_u_hash_del_key_or_index(HashTable *ht, zend_uchar type, void *
                        && (p->nKeyLength == nKeyLength)
                    && ((p->nKeyLength == 0) /* Numeric index (short circuits the memcmp()) */
                                || ((p->key.type == type)
-                               && !memcmp(&p->key.u, arKey, realKeyLength)))) {
+                               && !memcmp(p->key.arKey.s, arKey.s, realKeyLength)))) {
                        HANDLE_BLOCK_INTERRUPTIONS();
                        if (p == ht->arBuckets[nIndex]) {
                                ht->arBuckets[nIndex] = p->pNext;
@@ -594,7 +594,7 @@ ZEND_API int zend_u_hash_del_key_or_index(HashTable *ht, zend_uchar type, void *
 
 ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag)
 {
-       return zend_u_hash_del_key_or_index(ht, IS_STRING, arKey, nKeyLength, h, flag);
+       return zend_u_hash_del_key_or_index(ht, IS_STRING, (zstr)arKey, nKeyLength, h, flag);
 }
 
 ZEND_API void zend_hash_destroy(HashTable *ht)
@@ -800,11 +800,7 @@ ZEND_API void zend_hash_apply_with_arguments(HashTable *ht, apply_func_args_t de
                hash_key.nKeyLength = p->nKeyLength;
                hash_key.h = p->h;
                hash_key.type = p->key.type;
-               if (hash_key.type == IS_UNICODE) {
-                       hash_key.u.unicode = p->key.u.unicode;
-               } else {
-                       hash_key.u.string = p->key.u.string;
-               }
+               hash_key.arKey.s = p->key.arKey.s;
                if (destruct(p->pData, num_args, args, &hash_key)) {
                        p = zend_hash_apply_deleter(ht, p);
                } else {
@@ -834,7 +830,7 @@ ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSR
                        if (q->nKeyLength==0) {
                                zend_hash_index_del(ht, q->h);
                        } else {
-                               zend_u_hash_del(ht, q->key.type, &q->key.u.unicode, q->nKeyLength);
+                               zend_u_hash_del(ht, q->key.type, (zstr)q->key.arKey.s, q->nKeyLength);
                        }
                }
                if (result & ZEND_HASH_APPLY_STOP) {
@@ -858,7 +854,7 @@ ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_fun
                if (p->nKeyLength == 0) {
                        zend_hash_index_update(target, p->h, p->pData, size, &new_entry);
                } else {
-                       zend_u_hash_update(target, p->key.type, &p->key.u, p->nKeyLength, p->pData, size, &new_entry);
+                       zend_u_hash_update(target, p->key.type, (zstr)p->key.arKey.s, p->nKeyLength, p->pData, size, &new_entry);
                }
                if (pCopyConstructor) {
                        pCopyConstructor(new_entry);
@@ -885,7 +881,7 @@ ZEND_API void _zend_hash_merge(HashTable *target, HashTable *source, copy_ctor_f
                                pCopyConstructor(t);
                        }
                } else {
-                       if (_zend_u_hash_add_or_update(target, p->key.type, &p->key.u, p->nKeyLength, p->pData, size, &t, mode ZEND_FILE_LINE_RELAY_CC)==SUCCESS && pCopyConstructor) {
+                       if (_zend_u_hash_add_or_update(target, p->key.type, (zstr)p->key.arKey.s, p->nKeyLength, p->pData, size, &t, mode ZEND_FILE_LINE_RELAY_CC)==SUCCESS && pCopyConstructor) {
                                pCopyConstructor(t);
                        }
                }
@@ -902,11 +898,7 @@ static zend_bool zend_hash_replace_checker_wrapper(HashTable *target, void *sour
        hash_key.nKeyLength = p->nKeyLength;
        hash_key.h = p->h;
        hash_key.type = p->key.type;
-       if (hash_key.type == IS_UNICODE) {
-               hash_key.u.unicode = p->key.u.unicode;
-       } else {
-               hash_key.u.string = p->key.u.string;
-       }
+       hash_key.arKey.s = p->key.arKey.s;
        return merge_checker_func(target, source_data, &hash_key, pParam);
 }
 
@@ -922,7 +914,7 @@ ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor
        p = source->pListHead;
        while (p) {
                if (zend_hash_replace_checker_wrapper(target, p->pData, p, pParam, pMergeSource)) {
-                       if (zend_u_hash_quick_update(target, p->key.type, &p->key.u, p->nKeyLength, p->h, p->pData, size, &t)==SUCCESS && pCopyConstructor) {
+                       if (zend_u_hash_quick_update(target, p->key.type, (zstr)p->key.arKey.s, p->nKeyLength, p->h, p->pData, size, &t)==SUCCESS && pCopyConstructor) {
                                pCopyConstructor(t);
                        }
                }
@@ -932,14 +924,14 @@ ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor
 }
 
 
-ZEND_API ulong zend_u_get_hash_value(zend_uchar type, char *arKey, uint nKeyLength)
+ZEND_API ulong zend_u_get_hash_value(zend_uchar type, zstr arKey, uint nKeyLength)
 {
        return zend_u_inline_hash_func(type, arKey, nKeyLength);
 }
 
 ZEND_API ulong zend_get_hash_value(char *arKey, uint nKeyLength)
 {
-       return zend_u_get_hash_value(IS_STRING, arKey, nKeyLength);
+       return zend_u_get_hash_value(IS_STRING, (zstr)arKey, nKeyLength);
 }
 
 
@@ -947,7 +939,7 @@ ZEND_API ulong zend_get_hash_value(char *arKey, uint nKeyLength)
  * data is returned in pData. The reason is that there's no reason
  * someone using the hash table might not want to have NULL data
  */
-ZEND_API int zend_u_hash_find(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, void **pData)
+ZEND_API int zend_u_hash_find(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, void **pData)
 {
        ulong h;
        uint nIndex;
@@ -968,7 +960,7 @@ ZEND_API int zend_u_hash_find(HashTable *ht, zend_uchar type, void *arKey, uint
                if ((p->h == h) &&
                    (p->key.type == type) &&
                    (p->nKeyLength == nKeyLength) &&
-                   !memcmp(&p->key.u, arKey, realKeyLength)) {
+                   !memcmp(p->key.arKey.s, arKey.s, realKeyLength)) {
                        *pData = p->pData;
                        if (tmp) efree(tmp);
                        return SUCCESS;
@@ -981,11 +973,11 @@ ZEND_API int zend_u_hash_find(HashTable *ht, zend_uchar type, void *arKey, uint
 
 ZEND_API int zend_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData)
 {
-       return zend_u_hash_find(ht, IS_STRING, arKey, nKeyLength, pData);
+       return zend_u_hash_find(ht, IS_STRING, (zstr)arKey, nKeyLength, pData);
 }
 
 
-ZEND_API int zend_u_hash_quick_find(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, ulong h, void **pData)
+ZEND_API int zend_u_hash_quick_find(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, ulong h, void **pData)
 {
        uint nIndex;
        Bucket *p;
@@ -1011,7 +1003,7 @@ ZEND_API int zend_u_hash_quick_find(HashTable *ht, zend_uchar type, void *arKey,
                if ((p->h == h) &&
                    (p->key.type == type) &&
                    (p->nKeyLength == nKeyLength) &&
-                   !memcmp(&p->key.u, arKey, realKeyLength)) {
+                   !memcmp(p->key.arKey.s, arKey.s, realKeyLength)) {
                        *pData = p->pData;
                        if (tmp) efree(tmp);
                        return SUCCESS;
@@ -1024,10 +1016,10 @@ ZEND_API int zend_u_hash_quick_find(HashTable *ht, zend_uchar type, void *arKey,
 
 ZEND_API int zend_hash_quick_find(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData)
 {
-       return zend_u_hash_quick_find(ht, IS_STRING, arKey, nKeyLength, h, pData);
+       return zend_u_hash_quick_find(ht, IS_STRING, (zstr)arKey, nKeyLength, h, pData);
 }
 
-ZEND_API int zend_u_hash_exists(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength)
+ZEND_API int zend_u_hash_exists(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength)
 {
        ulong h;
        uint nIndex;
@@ -1048,7 +1040,7 @@ ZEND_API int zend_u_hash_exists(HashTable *ht, zend_uchar type, void *arKey, uin
                if ((p->h == h) &&
                    (p->key.type == type) &&
                    (p->nKeyLength == nKeyLength) &&
-                   !memcmp(&p->key.u, arKey, realKeyLength)) {
+                   !memcmp(p->key.arKey.s, arKey.s, realKeyLength)) {
                        if (tmp) efree(tmp);
                        return 1;
                }
@@ -1060,10 +1052,10 @@ ZEND_API int zend_u_hash_exists(HashTable *ht, zend_uchar type, void *arKey, uin
 
 ZEND_API int zend_hash_exists(HashTable *ht, char *arKey, uint nKeyLength)
 {
-       return zend_u_hash_exists(ht, IS_STRING, arKey, nKeyLength);
+       return zend_u_hash_exists(ht, IS_STRING, (zstr)arKey, nKeyLength);
 }
 
-ZEND_API int zend_u_hash_quick_exists(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, ulong h)
+ZEND_API int zend_u_hash_quick_exists(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, ulong h)
 {
        uint nIndex;
        Bucket *p;
@@ -1089,7 +1081,7 @@ ZEND_API int zend_u_hash_quick_exists(HashTable *ht, zend_uchar type, void *arKe
                if ((p->h == h) &&
                    (p->key.type == type) &&
                    (p->nKeyLength == nKeyLength) &&
-                   !memcmp(&p->key.u, arKey, realKeyLength)) {
+                   !memcmp(p->key.arKey.s, arKey.s, realKeyLength)) {
                  if (tmp) efree(tmp);
                        return 1;
                }
@@ -1101,7 +1093,7 @@ ZEND_API int zend_u_hash_quick_exists(HashTable *ht, zend_uchar type, void *arKe
 
 ZEND_API int zend_hash_quick_exists(HashTable *ht, char *arKey, uint nKeyLength, ulong h)
 {
-       return zend_u_hash_quick_exists(ht, IS_STRING, arKey, nKeyLength, h);
+       return zend_u_hash_quick_exists(ht, IS_STRING, (zstr)arKey, nKeyLength, h);
 }
 
 ZEND_API int zend_hash_index_find(HashTable *ht, ulong h, void **pData)
@@ -1206,7 +1198,7 @@ ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos)
 
 
 /* This function should be made binary safe  */
-ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos)
+ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, zstr *str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos)
 {
        Bucket *p;
 
@@ -1218,9 +1210,9 @@ ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, uint
                if (p->nKeyLength) {
                        if (p->key.type == IS_STRING) {
                                if (duplicate) {
-                                       *str_index = estrndup(p->key.u.string, p->nKeyLength-1);
+                                       str_index->s = estrndup(p->key.arKey.s, p->nKeyLength-1);
                                } else {
-                                       *str_index = p->key.u.string;
+                                       str_index->s = p->key.arKey.s;
                                }
                                if (str_length) {
                                        *str_length = p->nKeyLength;
@@ -1228,9 +1220,9 @@ ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, uint
                                return HASH_KEY_IS_STRING;
                        } else if (p->key.type == IS_UNICODE) {
                                if (duplicate) {
-                                       *str_index = (char*)eustrndup(p->key.u.unicode, p->nKeyLength-1);
+                                       str_index->u = eustrndup(p->key.arKey.u, p->nKeyLength-1);
                                } else {
-                                       *str_index = p->key.u.string;
+                                       str_index->u = p->key.arKey.u;
                                }
                                if (str_length) {
                                        *str_length = p->nKeyLength;
@@ -1288,7 +1280,7 @@ ZEND_API int zend_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosi
 /* This function changes key of currevt element without changing elements'
  * order. If element with target key already exists, it will be deleted first.
  */
-ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, char *str_index, uint str_length, ulong num_index, HashPosition *pos)
+ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, zstr str_index, uint str_length, ulong num_index, HashPosition *pos)
 {
        Bucket *p;
        uint real_length;
@@ -1308,7 +1300,7 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, char *
                        real_length = str_length;
                        if (p->nKeyLength == str_length &&
                            p->key.type == IS_STRING &&
-                           memcmp(p->key.u.string, str_index, str_length) == 0) {
+                           memcmp(p->key.arKey.s, str_index.s, str_length) == 0) {
                                return SUCCESS;
                        }
                        zend_u_hash_del(ht, IS_STRING, str_index, str_length);
@@ -1316,7 +1308,7 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, char *
                        real_length = str_length * sizeof(UChar);
                        if (p->nKeyLength == str_length &&
                            p->key.type == IS_UNICODE &&
-                           memcmp(p->key.u.string, str_index, real_length) == 0) {
+                           memcmp(p->key.arKey.u, str_index.u, real_length) == 0) {
                                return SUCCESS;
                        }
                        zend_u_hash_del(ht, IS_UNICODE, str_index, str_length);
@@ -1370,12 +1362,12 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, char *
                if (key_type == HASH_KEY_IS_LONG) {
                        p->h = num_index;
                } else if (key_type == HASH_KEY_IS_UNICODE) {
-                       memcpy(p->key.u.unicode, str_index, real_length);
-           p->key.type = IS_UNICODE;
+                       memcpy(p->key.arKey.u, str_index.u, real_length);
+                       p->key.type = IS_UNICODE;
                        p->h = zend_u_inline_hash_func(IS_UNICODE, str_index, str_length);
                } else {
-                       memcpy(p->key.u.string, str_index, real_length);
-           p->key.type = IS_STRING;
+                       memcpy(p->key.arKey.s, str_index.s, real_length);
+                       p->key.type = IS_STRING;
                        p->h = zend_u_inline_hash_func(p->key.type, str_index, str_length);
                }
 
@@ -1496,7 +1488,7 @@ ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t co
                                        result = p1->nKeyLength - p2->nKeyLength;
                                }
                                if (result==0) {
-                                       result = memcmp(&p1->key.u, &p2->key.u, REAL_KEY_SIZE(p1->key.type, p1->nKeyLength));
+                                       result = memcmp(p1->key.arKey.s, p2->key.arKey.s, REAL_KEY_SIZE(p1->key.type, p1->nKeyLength));
                                }
                                if (result!=0) {
                                        HASH_UNPROTECT_RECURSION(ht1);
@@ -1513,7 +1505,7 @@ ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t co
                                        return 1;
                                }
                        } else { /* string, binary or unicode index */
-                               if (zend_u_hash_find(ht2, p1->key.type, &p1->key.u, p1->nKeyLength, &pData2)==FAILURE) {
+                               if (zend_u_hash_find(ht2, p1->key.type, (zstr)p1->key.arKey.s, p1->nKeyLength, &pData2)==FAILURE) {
                                        HASH_UNPROTECT_RECURSION(ht1);
                                        HASH_UNPROTECT_RECURSION(ht2);
                                        return 1;
@@ -1610,7 +1602,7 @@ ZEND_API ulong zend_hash_next_free_element(HashTable *ht)
 
 #define HANDLE_U_NUMERIC(key, length, func) {                                                                                          \
        register UChar *tmp=key;                                                                                                                                \
-       register int32_t val; \
+       register int val; \
                                                                                                                                                                                \
        if (*tmp=='-') {                                                                                                                                        \
                tmp++;                                                                                                                                                  \
@@ -1645,60 +1637,60 @@ ZEND_API ulong zend_hash_next_free_element(HashTable *ht)
        } while (0);                                                                                                                                            \
 }
 
-ZEND_API int zend_u_symtable_update(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest)
+ZEND_API int zend_u_symtable_update(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest)
 {
        if (type == IS_STRING) {
-               HANDLE_NUMERIC((char*)arKey, nKeyLength, zend_hash_index_update(ht, idx, pData, nDataSize, pDest));
+               HANDLE_NUMERIC(arKey.s, nKeyLength, zend_hash_index_update(ht, idx, pData, nDataSize, pDest));
        } else if (type == IS_UNICODE) {
-               HANDLE_U_NUMERIC((UChar*)arKey, nKeyLength, zend_hash_index_update(ht, idx, pData, nDataSize, pDest));
+               HANDLE_U_NUMERIC(arKey.u, nKeyLength, zend_hash_index_update(ht, idx, pData, nDataSize, pDest));
        }
        return zend_u_hash_update(ht, type, arKey, nKeyLength, pData, nDataSize, pDest);
 }
 
 
-ZEND_API int zend_u_symtable_del(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength)
+ZEND_API int zend_u_symtable_del(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength)
 {
        if (type == IS_STRING) {
-               HANDLE_NUMERIC((char*)arKey, nKeyLength, zend_hash_index_del(ht, idx));
+               HANDLE_NUMERIC(arKey.s, nKeyLength, zend_hash_index_del(ht, idx));
        } else if (type == IS_UNICODE) {
-               HANDLE_U_NUMERIC((UChar*)arKey, nKeyLength, zend_hash_index_del(ht, idx));
+               HANDLE_U_NUMERIC(arKey.u, nKeyLength, zend_hash_index_del(ht, idx));
        }
        return zend_u_hash_del(ht, type, arKey, nKeyLength);
 }
 
 
-ZEND_API int zend_u_symtable_find(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, void **pData)
+ZEND_API int zend_u_symtable_find(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, void **pData)
 {
        if (type == IS_STRING) {
-               HANDLE_NUMERIC((char*)arKey, nKeyLength, zend_hash_index_find(ht, idx, pData));
+               HANDLE_NUMERIC(arKey.s, nKeyLength, zend_hash_index_find(ht, idx, pData));
        } else if (type == IS_UNICODE) {
-               HANDLE_U_NUMERIC((UChar*)arKey, nKeyLength, zend_hash_index_find(ht, idx, pData));
+               HANDLE_U_NUMERIC(arKey.u, nKeyLength, zend_hash_index_find(ht, idx, pData));
        }
        return zend_u_hash_find(ht, type, arKey, nKeyLength, pData);
 }
 
 
-ZEND_API int zend_u_symtable_exists(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength)
+ZEND_API int zend_u_symtable_exists(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength)
 {
        if (type == IS_STRING) {
-               HANDLE_NUMERIC((char*)arKey, nKeyLength, zend_hash_index_exists(ht, idx));
+               HANDLE_NUMERIC(arKey.s, nKeyLength, zend_hash_index_exists(ht, idx));
        } else if (type == IS_UNICODE) {
-               HANDLE_U_NUMERIC((UChar*)arKey, nKeyLength, zend_hash_index_exists(ht, idx));
+               HANDLE_U_NUMERIC(arKey.u, nKeyLength, zend_hash_index_exists(ht, idx));
        }
        return zend_u_hash_exists(ht, type, arKey, nKeyLength);
 }
 
 
-ZEND_API int zend_u_symtable_update_current_key(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength)
+ZEND_API int zend_u_symtable_update_current_key(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength)
 {
        zend_uchar key_type;
 
        if (type == IS_STRING) {
                key_type = HASH_KEY_IS_STRING;
-               HANDLE_NUMERIC((char*)arKey, nKeyLength, zend_hash_update_current_key(ht, HASH_KEY_IS_LONG, NULL, 0, idx));
-       } else if (type == IS_UNICODE) {
+               HANDLE_NUMERIC(arKey.s, nKeyLength, zend_hash_update_current_key(ht, HASH_KEY_IS_LONG, (zstr)NULL, 0, idx));
+       } else {
                key_type = HASH_KEY_IS_UNICODE;
-               HANDLE_U_NUMERIC((UChar*)arKey, nKeyLength, zend_hash_update_current_key(ht, HASH_KEY_IS_LONG, NULL, 0, idx));
+               HANDLE_U_NUMERIC(arKey.u, nKeyLength, zend_hash_update_current_key(ht, HASH_KEY_IS_LONG, (zstr)NULL, 0, idx));
        }
        return zend_hash_update_current_key(ht, key_type, arKey, nKeyLength, 0);
 }
@@ -1734,8 +1726,8 @@ ZEND_API int zend_symtable_exists(HashTable *ht, char *arKey, uint nKeyLength)
 
 ZEND_API int zend_symtable_update_current_key(HashTable *ht, char *arKey, uint nKeyLength)
 {
-       HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_update_current_key(ht, HASH_KEY_IS_LONG, NULL, 0, idx));
-       return zend_hash_update_current_key(ht, HASH_KEY_IS_STRING, arKey, nKeyLength, 0);
+       HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_update_current_key(ht, HASH_KEY_IS_LONG, (zstr)NULL, 0, idx));
+       return zend_hash_update_current_key(ht, HASH_KEY_IS_STRING, (zstr)arKey, nKeyLength, 0);
 }
 
 ZEND_API void zend_hash_to_unicode(HashTable *ht, apply_func_t apply_func TSRMLS_DC)
@@ -1755,17 +1747,17 @@ ZEND_API void zend_hash_to_unicode(HashTable *ht, apply_func_t apply_func TSRMLS
                if ((*p)->key.type == IS_STRING) {
                        UErrorCode status = U_ZERO_ERROR;
                        UChar *u = NULL;
-                       int32_t u_len;
+                       int u_len;
                        Bucket *q;
 
-                       zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u, &u_len, (char*)(*p)->key.u.string, (*p)->nKeyLength-1, &status);
+                       zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u, &u_len, (*p)->key.arKey.s, (*p)->nKeyLength-1, &status);
 
-                       q = (Bucket *) pemalloc(sizeof(Bucket)-sizeof(q->key.u)+((u_len+1)*2), ht->persistent);
-                       memcpy(q, *p, sizeof(Bucket)-sizeof(q->key.u));
-                       memcpy(q->key.u.unicode, u, (u_len+1)*2);
+                       q = (Bucket *) pemalloc(sizeof(Bucket)-sizeof(q->key.arKey)+((u_len+1)*2), ht->persistent);
+                       memcpy(q, *p, sizeof(Bucket)-sizeof(q->key.arKey));
+                       memcpy(q->key.arKey.u, u, (u_len+1)*2);
                        q->key.type = IS_UNICODE;
                        q->nKeyLength = u_len+1;
-                       q->h = zend_u_inline_hash_func(IS_UNICODE, (void*)q->key.u.unicode, q->nKeyLength);
+                       q->h = zend_u_inline_hash_func(IS_UNICODE, q->key.arKey, q->nKeyLength);
                        if ((*p)->pData == &(*p)->pDataPtr) {
                                q->pData = &q->pDataPtr;
                        }
@@ -1796,9 +1788,9 @@ void zend_hash_display_pListTail(HashTable *ht)
        p = ht->pListTail;
        while (p != NULL) {
                if (p->key.type == IS_UNICODE) {
-                       /* TODO: ??? */
+                       /* FIXME: Unicode support??? */
                } else {
-                       zend_output_debug_string(0, "pListTail has key %s\n", p->key.u.string);
+                       zend_output_debug_string(0, "pListTail has key %s\n", p->key.arKey.s);
                }
                p = p->pListLast;
        }
@@ -1813,9 +1805,9 @@ void zend_hash_display(HashTable *ht)
                p = ht->arBuckets[i];
                while (p != NULL) {
                        if (p->key.type == IS_UNICODE) {
-                               /* TODO: ??? */
+                               /* FIXME: Unicode support??? */
                        } else {
-                               zend_output_debug_string(0, "%s <==> 0x%lX\n", p->key.u.string, p->h);
+                               zend_output_debug_string(0, "%s <==> 0x%lX\n", p->key.arKey.s, p->h);
                        }
                        p = p->pNext;
                }
@@ -1824,9 +1816,9 @@ void zend_hash_display(HashTable *ht)
        p = ht->pListTail;
        while (p != NULL) {
                if (p->key.type == IS_UNICODE) {
-                       /* TODO: ??? */
+                       /* FIXME: Unicode support??? */
                } else {
-                       zend_output_debug_string(0, "%s <==> 0x%lX\n", p->key.u.string, p->h);
+                       zend_output_debug_string(0, "%s <==> 0x%lX\n", p->key.arKey.s, p->h);
                }
                p = p->pListLast;
        }
index 942a7180446cd5f0c23ddeaa407591a0fbbaf30c..7e3dbd0ba4ea13bb84d22d44b0673ff03c4aa76d 100644 (file)
@@ -53,9 +53,9 @@ struct _hashtable;
 typedef struct _key {
        zend_uchar type;
        union {
-               char  string[1];   /* Must be last element */
-               UChar unicode[1]; /* Must be last element */
-       } u;
+               char  s[1];   /* Must be last element */
+               UChar u[1];   /* Must be last element */
+       } arKey;
 } HashKey;
 
 typedef struct bucket {
@@ -94,10 +94,7 @@ typedef struct _zend_hash_key {
        ulong h;
        uint nKeyLength;
        zend_uchar type;
-       union {
-               char  *string;
-               UChar *unicode;
-       } u;
+       zstr arKey;
 } zend_hash_key;
 
 
@@ -121,7 +118,7 @@ ZEND_API void zend_hash_clean(HashTable *ht);
 
 /* additions/updates/changes */
 ZEND_API int _zend_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC);
-ZEND_API int _zend_u_hash_add_or_update(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC);
+ZEND_API int _zend_u_hash_add_or_update(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC);
 #define zend_hash_update(ht, arKey, nKeyLength, pData, nDataSize, pDest) \
                _zend_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_UPDATE ZEND_FILE_LINE_CC)
 #define zend_u_hash_update(ht, type, arKey, nKeyLength, pData, nDataSize, pDest) \
@@ -132,7 +129,7 @@ ZEND_API int _zend_u_hash_add_or_update(HashTable *ht, zend_uchar type, void *ar
                _zend_u_hash_add_or_update(ht, type, arKey, nKeyLength, pData, nDataSize, pDest, HASH_ADD ZEND_FILE_LINE_CC)
 
 ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC);
-ZEND_API int _zend_u_hash_quick_add_or_update(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC);
+ZEND_API int _zend_u_hash_quick_add_or_update(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC);
 #define zend_hash_quick_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) \
                _zend_hash_quick_add_or_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest, HASH_UPDATE ZEND_FILE_LINE_CC)
 #define zend_u_hash_quick_update(ht, type, arKey, nKeyLength, h, pData, nDataSize, pDest) \
@@ -149,7 +146,7 @@ ZEND_API int _zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void
                _zend_hash_index_update_or_next_insert(ht, 0, pData, nDataSize, pDest, HASH_NEXT_INSERT ZEND_FILE_LINE_CC)
 
 ZEND_API int zend_hash_add_empty_element(HashTable *ht, char *arKey, uint nKeyLength);
-ZEND_API int zend_u_hash_add_empty_element(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength);
+ZEND_API int zend_u_hash_add_empty_element(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength);
 
 
 #define ZEND_HASH_APPLY_KEEP                           0
@@ -179,7 +176,7 @@ ZEND_API void zend_hash_to_unicode(HashTable *ht, apply_func_t apply_func TSRMLS
 
 /* Deletes */
 ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag);
-ZEND_API int zend_u_hash_del_key_or_index(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, ulong h, int flag);
+ZEND_API int zend_u_hash_del_key_or_index(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, ulong h, int flag);
 #define zend_hash_del(ht, arKey, nKeyLength) \
                zend_hash_del_key_or_index(ht, arKey, nKeyLength, 0, HASH_DEL_KEY)
 #define zend_u_hash_del(ht, type, arKey, nKeyLength) \
@@ -188,20 +185,20 @@ ZEND_API int zend_u_hash_del_key_or_index(HashTable *ht, zend_uchar type, void *
                zend_hash_del_key_or_index(ht, NULL, 0, h, HASH_DEL_INDEX)
 
 ZEND_API ulong zend_get_hash_value(char *arKey, uint nKeyLength);
-ZEND_API ulong zend_u_get_hash_value(zend_uchar type, char *arKey, uint nKeyLength);
+ZEND_API ulong zend_u_get_hash_value(zend_uchar type, zstr arKey, uint nKeyLength);
 
 /* Data retreival */
 ZEND_API int zend_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData);
-ZEND_API int zend_u_hash_find(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, void **pData);
+ZEND_API int zend_u_hash_find(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, void **pData);
 ZEND_API int zend_hash_quick_find(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData);
-ZEND_API int zend_u_hash_quick_find(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, ulong h, void **pData);
+ZEND_API int zend_u_hash_quick_find(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, ulong h, void **pData);
 ZEND_API int zend_hash_index_find(HashTable *ht, ulong h, void **pData);
 
 /* Misc */
 ZEND_API int zend_hash_exists(HashTable *ht, char *arKey, uint nKeyLength);
-ZEND_API int zend_u_hash_exists(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength);
+ZEND_API int zend_u_hash_exists(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength);
 ZEND_API int zend_hash_quick_exists(HashTable *ht, char *arKey, uint nKeyLength, ulong h);
-ZEND_API int zend_u_hash_quick_exists(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, ulong h);
+ZEND_API int zend_u_hash_quick_exists(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, ulong h);
 ZEND_API int zend_hash_index_exists(HashTable *ht, ulong h);
 ZEND_API ulong zend_hash_next_free_element(HashTable *ht);
 
@@ -211,12 +208,12 @@ ZEND_API ulong zend_hash_next_free_element(HashTable *ht);
        (zend_hash_get_current_key_type_ex(ht, pos) == HASH_KEY_NON_EXISTANT ? FAILURE : SUCCESS)
 ZEND_API int zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos);
 ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos);
-ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos);
+ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, zstr *str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos);
 ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos);
 ZEND_API int zend_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosition *pos);
 ZEND_API void zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos);
 ZEND_API void zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos);
-ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, char *str_index, uint str_length, ulong num_index, HashPosition *pos);
+ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, zstr str_index, uint str_length, ulong num_index, HashPosition *pos);
 
 #define zend_hash_has_more_elements(ht) \
        zend_hash_has_more_elements_ex(ht, NULL)
@@ -315,10 +312,10 @@ EMPTY_SWITCH_DEFAULT_CASE()
 }
 
 #define zend_u_inline_hash_func(type, arKey, nKeyLength) \
-       zend_inline_hash_func(arKey, REAL_KEY_SIZE(type, nKeyLength))
+       zend_inline_hash_func(arKey.s, REAL_KEY_SIZE(type, nKeyLength))
 
 ZEND_API ulong zend_hash_func(char *arKey, uint nKeyLength);
-ZEND_API ulong zend_u_hash_func(zend_uchar type, char *arKey, uint nKeyLength);
+ZEND_API ulong zend_u_hash_func(zend_uchar type, zstr arKey, uint nKeyLength);
 
 #if ZEND_DEBUG
 /* debug */
@@ -341,11 +338,11 @@ ZEND_API int zend_symtable_find(HashTable *ht, char *arKey, uint nKeyLength, voi
 ZEND_API int zend_symtable_exists(HashTable *ht, char *arKey, uint nKeyLength);
 ZEND_API int zend_symtable_update_current_key(HashTable *ht, char *arKey, uint nKeyLength);
 
-ZEND_API int zend_u_symtable_update(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest);
-ZEND_API int zend_u_symtable_del(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength);
-ZEND_API int zend_u_symtable_find(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, void **pData);
-ZEND_API int zend_u_symtable_exists(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength);
-ZEND_API int zend_u_symtable_update_current_key(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength);
+ZEND_API int zend_u_symtable_update(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest);
+ZEND_API int zend_u_symtable_del(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength);
+ZEND_API int zend_u_symtable_find(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, void **pData);
+ZEND_API int zend_u_symtable_exists(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength);
+ZEND_API int zend_u_symtable_update_current_key(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength);
 
 #endif                                                 /* ZEND_HASH_H */
 
index 797ef83c5a8be4adce86421f7ed4c53b166ebbe1..f5e3474afd4906899e621c180314aae8d2f64dea 100644 (file)
@@ -153,11 +153,11 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
                                case T_DOC_COMMENT:
                                        break;
                                default:
-                                       efree(Z_UNIVAL(token));
+                                       efree(Z_UNIVAL(token).v);
                                        break;
                        }
                } else if (token_type == T_END_HEREDOC) {
-                       efree(Z_UNIVAL(token));
+                       efree(Z_UNIVAL(token).v);
                }
                Z_TYPE(token) = 0;
        }
@@ -223,7 +223,7 @@ ZEND_API void zend_strip(TSRMLS_D)
                                        break;
 
                                default:
-                                       efree(Z_UNIVAL(token));
+                                       efree(Z_UNIVAL(token).v);
                                        break;
                        }
                }
index baa3d9a4e41718508c54cb7737539e7a3b0f8e04..148251b1a2fd6166b5277cbb86936c41fe6ec82b 100644 (file)
@@ -135,7 +135,7 @@ static int ini_key_compare(const void *a, const void *b TSRMLS_DC)
                return 1;
        } else { /* both strings */
                /*FIXME: unicode hash*/
-               return zend_binary_strcasecmp(f->key.u.string, f->nKeyLength, s->key.u.string, s->nKeyLength);
+               return zend_binary_strcasecmp(f->key.arKey.s, f->nKeyLength, s->key.arKey.s, s->nKeyLength);
        }
 }
 
index 46a18e7332902c573397521f3cf79791432941de..4a02875938fe4fd2c2d99912a2dd470f1921d096 100755 (executable)
@@ -76,7 +76,7 @@ ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend
                if (!fn_proxy || !*fn_proxy) {
                        if (zend_hash_find(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 %v%s%s", obj_ce ? (void*)obj_ce->name : EMPTY_STR, obj_ce ? "::" : "", function_name);
+                               zend_error(E_CORE_ERROR, "Couldn't find implementation for method %v%s%s", obj_ce ? obj_ce->name : (zstr)EMPTY_STR, obj_ce ? "::" : "", function_name);
                        }
                        if (fn_proxy) {
                                *fn_proxy = fcic.function_handler;
@@ -93,7 +93,7 @@ ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend
                if (!obj_ce) {
                        obj_ce = object_pp ? Z_OBJCE_PP(object_pp) : NULL;
                }
-               zend_error(E_CORE_ERROR, "Couldn't execute method %v%s%s", obj_ce ? (void*)obj_ce->name : EMPTY_STR, obj_ce ? "::" : "", function_name);
+               zend_error(E_CORE_ERROR, "Couldn't execute method %v%s%s", obj_ce ? obj_ce->name : (zstr)EMPTY_STR, obj_ce ? "::" : "", function_name);
        }
        if (!retval_ptr_ptr) {
                if (retval) {
@@ -176,7 +176,7 @@ ZEND_API void zend_user_it_get_current_data(zend_object_iterator *_iter, zval **
 
 /* {{{ zend_user_it_get_current_key_default */
 #if 0
-static int zend_user_it_get_current_key_default(zend_object_iterator *_iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)
+static int zend_user_it_get_current_key_default(zend_object_iterator *_iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)
 {
        *int_key = _iter->index;
        return HASH_KEY_IS_LONG;
@@ -185,7 +185,7 @@ static int zend_user_it_get_current_key_default(zend_object_iterator *_iter, cha
 /* }}} */
 
 /* {{{ zend_user_it_get_current_key */
-ZEND_API int zend_user_it_get_current_key(zend_object_iterator *_iter, char **str_key, uint *str_key_len, ulong *int_key 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)
 {
        zend_user_iterator *iter = (zend_user_iterator*)_iter;
        zval *object = (zval*)iter->it.data;
@@ -210,13 +210,13 @@ ZEND_API int zend_user_it_get_current_key(zend_object_iterator *_iter, char **st
                        return HASH_KEY_IS_LONG;
 
                case IS_STRING:
-                       *str_key = estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval));
+                       str_key->s = estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval));
                        *str_key_len = Z_STRLEN_P(retval)+1;
                        zval_ptr_dtor(&retval);
                        return HASH_KEY_IS_STRING;
 
                case IS_UNICODE:
-                       *str_key = (char*)eustrndup(Z_USTRVAL_P(retval), Z_USTRLEN_P(retval));
+                       str_key->u = eustrndup(Z_USTRVAL_P(retval), Z_USTRLEN_P(retval));
                        *str_key_len = Z_USTRLEN_P(retval)+1;
                        zval_ptr_dtor(&retval);
                        return HASH_KEY_IS_UNICODE;
index 81cadfb907388c3c0d9efe822004ad09c6f6c443..f6ee0847e10dbe3ed70f98340e33fb85790e1166 100755 (executable)
@@ -51,7 +51,7 @@ ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend
 
 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, char **str_key, uint *str_key_len, ulong *int_key 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);
 ZEND_API void zend_user_it_get_current_data(zend_object_iterator *_iter, zval ***data TSRMLS_DC);
 ZEND_API void zend_user_it_move_forward(zend_object_iterator *_iter TSRMLS_DC);
 ZEND_API void zend_user_it_invalidate_current(zend_object_iterator *_iter TSRMLS_DC);
index 4a43f44143c38e12c5b692fbeaa59748e336109c..a831456f5c01bf3b8bb2551cb8d6e49d4d6b3c63 100755 (executable)
@@ -51,8 +51,8 @@ static zend_object_handlers iterator_object_handlers = {
 ZEND_API void zend_register_iterator_wrapper(TSRMLS_D)
 {
        INIT_CLASS_ENTRY(zend_iterator_class_entry, "__iterator_wrapper", NULL);
-       free(zend_iterator_class_entry.name);
-       zend_iterator_class_entry.name = "__iterator_wrapper";
+       free(zend_iterator_class_entry.name.s);
+       zend_iterator_class_entry.name.s = "__iterator_wrapper";
 }
 
 static void iter_wrapper_dtor(void *object, zend_object_handle handle TSRMLS_DC)
index 664e2ca42ac81cd4e0a1945cea261a1169b9cec9..2104531710b3ee643c35eef40921bd7fe9b0f952 100755 (executable)
@@ -39,7 +39,7 @@ typedef struct _zend_object_iterator_funcs {
        void (*get_current_data)(zend_object_iterator *iter, zval ***data TSRMLS_DC);
 
        /* fetch the key for the current element (return HASH_KEY_IS_STRING or HASH_KEY_IS_LONG) (optional, may be NULL) */
-       int (*get_current_key)(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC);
+       int (*get_current_key)(zend_object_iterator *iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC);
 
        /* step forwards to next element */
        void (*move_forward)(zend_object_iterator *iter TSRMLS_DC);
index 0f5b067b06aa526d14037bb682889c0149eea2ce..938147f6ecb100e859406371e2d89e2e74a0972b 100644 (file)
@@ -370,7 +370,7 @@ static inline int zend_uchar_from_name(char *name, UChar32 *c)
        }
 }
 
-static inline int zend_uchar_from_uname(UChar *name, int32_t name_len, UChar32 *c)
+static inline int zend_uchar_from_uname(UChar *name, int name_len, UChar32 *c)
 {
        UChar32 codepoint = 0;
        UErrorCode status = U_ZERO_ERROR;
@@ -413,7 +413,7 @@ static inline int zend_parse_charname_sequence(UChar **s, UChar *end, UChar32 *c
 static inline int zend_copy_string_value(zval *zendlval, char *str, zend_uint str_len, zend_uchar type TSRMLS_DC)
 {
        UErrorCode status = U_ZERO_ERROR;
-       int32_t consumed = 0;
+       int consumed = 0;
 
        if (type == IS_UNICODE) {
                consumed = zend_convert_scanner_output(&Z_USTRVAL_P(zendlval), &Z_USTRLEN_P(zendlval), str, str_len, &status TSRMLS_CC);
@@ -436,7 +436,7 @@ static inline int zend_copy_string_value(zval *zendlval, char *str, zend_uint st
 static inline int zend_check_and_normalize_identifier(zval *zendlval)
 {
        UChar *norm;
-       int32_t norm_len;
+       int norm_len;
 
        if (!zend_is_valid_identifier(Z_USTRVAL_P(zendlval), Z_USTRLEN_P(zendlval))) {
                zend_error(E_COMPILE_WARNING, "Invalid identifier syntax: %r", Z_USTRVAL_P(zendlval));
@@ -621,7 +621,7 @@ ZEND_API int zend_prepare_scanner_converters(const char *onetime_encoding, int r
        return zend_set_converter_encoding(&SCNG(output_conv), encoding);
 }
 
-ZEND_API int32_t zend_convert_scanner_output(UChar **target, int32_t *target_len, const char *source, int32_t source_len, UErrorCode *status TSRMLS_DC)
+ZEND_API int zend_convert_scanner_output(UChar **target, int *target_len, const char *source, int source_len, UErrorCode *status TSRMLS_DC)
 {
        const char *source_consumed = NULL;
 
@@ -1891,13 +1891,13 @@ NEWLINE ("\r"|"\n"|"\r\n")
 }
 
 <ST_IN_SCRIPTING>"__CLASS__" {
-       char *class_name = NULL;
+       zstr class_name = (zstr)NULL;
 
        if (CG(active_class_entry)) {
                class_name = CG(active_class_entry)->name;
        }
 
-       if (!class_name) {
+       if (!class_name.v) {
                ZVAL_EMPTY_TEXT(zendlval);
        } else {
                ZVAL_TEXT(zendlval, class_name, 1);
@@ -1906,16 +1906,13 @@ NEWLINE ("\r"|"\n"|"\r\n")
 }
 
 <ST_IN_SCRIPTING>"__FUNCTION__" {
-       char *func_name = NULL;
+       zstr func_name = (zstr)NULL;
 
        if (CG(active_op_array)) {
                func_name = CG(active_op_array)->function_name;
        }
 
-       if (!func_name) {
-               func_name = "";
-       }
-       if (!func_name) {
+       if (!func_name.v) {
                ZVAL_EMPTY_TEXT(zendlval);
        } else {
                ZVAL_TEXT(zendlval, func_name, 1);
@@ -1924,47 +1921,47 @@ NEWLINE ("\r"|"\n"|"\r\n")
 }
 
 <ST_IN_SCRIPTING>"__METHOD__" {
-       char *class_name = CG(active_class_entry) ? CG(active_class_entry)->name : NULL;
-       char *func_name = CG(active_op_array)? CG(active_op_array)->function_name : NULL;
+       zstr class_name = CG(active_class_entry) ? CG(active_class_entry)->name : (zstr)NULL;
+       zstr func_name = CG(active_op_array)? CG(active_op_array)->function_name : (zstr)NULL;
        size_t len = 0;
 
        if (UG(unicode)) {
                size_t len1;
 
-               if (class_name) {
-                       len += len1 = u_strlen((UChar*)class_name);
+               if (class_name.u) {
+                       len += len1 = u_strlen(class_name.u);
                        len += 2;
                }
-               if (func_name) {
-                       len += u_strlen((UChar*)func_name);
+               if (func_name.u) {
+                       len += u_strlen(func_name.u);
                } else {
-                       func_name = (char*)EMPTY_STR;
+                       func_name.u = EMPTY_STR;
                }
                Z_USTRLEN_P(zendlval) = len;
                Z_USTRVAL_P(zendlval) = eumalloc(len+1);
-               if (class_name) {
-                       u_strcpy(Z_USTRVAL_P(zendlval), (UChar*)class_name);
+               if (class_name.u) {
+                       u_strcpy(Z_USTRVAL_P(zendlval), class_name.u);
                        Z_USTRVAL_P(zendlval)[len1] = 0x3a;   /* ':' */
                        Z_USTRVAL_P(zendlval)[len1+1] = 0x3a; /* ':' */
                        Z_USTRVAL_P(zendlval)[len1+2] = 0;
                } else {
                        Z_USTRVAL_P(zendlval)[0] = 0;
                }
-               u_strcat(Z_USTRVAL_P(zendlval), (UChar*)func_name);
+               u_strcat(Z_USTRVAL_P(zendlval), func_name.u);
                Z_TYPE_P(zendlval) = IS_UNICODE;
        } else {
-               if (class_name) {
-                       len += strlen(class_name) + 2;
+               if (class_name.s) {
+                       len += strlen(class_name.s) + 2;
                }
-               if (func_name) {
-                       len += strlen(func_name);
+               if (func_name.s) {
+                       len += strlen(func_name.s);
                }
 
                Z_STRVAL_P(zendlval) = emalloc(len+1);
                Z_STRLEN_P(zendlval) = sprintf(Z_STRVAL_P(zendlval), "%s%s%s",
-                       class_name ? class_name : "",
-                       class_name && func_name ? "::" : "",
-                       func_name ? func_name : ""
+                       class_name.s ? class_name.s : "",
+                       class_name.s && func_name.s ? "::" : "",
+                       func_name.s ? func_name.s : ""
                        );
                Z_STRLEN_P(zendlval) = strlen(Z_STRVAL_P(zendlval));
                Z_TYPE_P(zendlval) = IS_STRING;
index 9cb9546958a98868306a530fe1d25709270f2ef5..0f1118f54ed4383f19a3e8b0d1acbe6ad098d4f1 100644 (file)
@@ -115,7 +115,7 @@ ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, c
        va_list resource_types;
        int i;
        char *space;
-       char *class_name;
+       zstr class_name;
 
        if (default_id==-1) { /* use id */
                if (!passed_id) {
index c00e8b6d50ff6d14e1834d399fe2bd146b04e5ed..db38d87b6f21832860b1e00b95427c230745c711 100644 (file)
@@ -245,30 +245,30 @@ ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce
 }
 
 
-ZEND_API int zend_check_property_access(zend_object *zobj, zend_uchar utype, void *prop_info_name TSRMLS_DC)
+ZEND_API int zend_check_property_access(zend_object *zobj, zend_uchar utype, zstr prop_info_name TSRMLS_DC)
 {
        zend_property_info *property_info;
-       char *class_name, *prop_name;
+       zstr class_name, prop_name;
        zval member;
 
        zend_u_unmangle_property_name(utype, prop_info_name, &class_name, &prop_name);
        if (utype == IS_UNICODE) {
-               ZVAL_UNICODE(&member, (UChar*)prop_name, 0);
+               ZVAL_UNICODE(&member, prop_name.u, 0);
        } else {
-               ZVAL_STRING(&member, prop_name, 0);
+               ZVAL_STRING(&member, prop_name.s, 0);
        }
        property_info = zend_get_property_info(zobj->ce, &member, 1 TSRMLS_CC);
        if (!property_info) {
                return FAILURE;
        }
-       if (class_name && class_name[0] != '*') {
+       if (class_name.s && class_name.s[0] != '*') {
                if (!(property_info->flags & ZEND_ACC_PRIVATE)) {
                        /* we we're looking for a private prop but found a non private one of the same name */
                        return FAILURE;
-               } else if (!UG(unicode) && strcmp((char*)prop_info_name+1, property_info->name+1)) {
+               } else if (!UG(unicode) && strcmp(prop_info_name.s+1, property_info->name.s+1)) {
                        /* we we're looking for a private prop but found a private one of the same name but another class */
                        return FAILURE;
-               } else if (UG(unicode) && u_strcmp(((UChar*)prop_info_name)+1, ((UChar*)property_info->name)+1)) {
+               } else if (UG(unicode) && u_strcmp(prop_info_name.u+1, property_info->name.u+1)) {
                        /* we we're looking for a private prop but found a private one of the same name but another class */
                        return FAILURE;
                }
@@ -285,7 +285,7 @@ static int zend_get_property_guard(zend_object *zobj, zend_property_info *proper
                property_info = &info;
                info.name = Z_UNIVAL_P(member);
                info.name_length = Z_UNILEN_P(member);
-               info.h = zend_u_get_hash_value(Z_TYPE_P(member), Z_STRVAL_P(member), Z_STRLEN_P(member) + 1);
+               info.h = zend_u_get_hash_value(Z_TYPE_P(member), Z_UNIVAL_P(member), Z_UNILEN_P(member) + 1);
        }
        if (!zobj->guards) {
                ALLOC_HASHTABLE(zobj->guards);
@@ -661,7 +661,7 @@ ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS)
  * Returns the function address that should be called, or NULL
  * if no such function exists.
  */
-static inline zend_function *zend_check_private_int(zend_function *fbc, zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC)
+static inline zend_function *zend_check_private_int(zend_function *fbc, zend_class_entry *ce, zstr function_name_strval, int function_name_strlen TSRMLS_DC)
 {
        if (!ce) {
                return 0;
@@ -696,7 +696,7 @@ static inline zend_function *zend_check_private_int(zend_function *fbc, zend_cla
 }
 
 
-ZEND_API int zend_check_private(zend_function *fbc, zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC)
+ZEND_API int zend_check_private(zend_function *fbc, zend_class_entry *ce, zstr function_name_strval, int function_name_strlen TSRMLS_DC)
 {
        return zend_check_private_int(fbc, ce, function_name_strval, function_name_strlen TSRMLS_CC) != NULL;
 }
@@ -731,12 +731,12 @@ ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope)
 }
 
 
-static union _zend_function *zend_std_get_method(zval **object_ptr, char *method_name, int method_len TSRMLS_DC)
+static union _zend_function *zend_std_get_method(zval **object_ptr, zstr method_name, int method_len TSRMLS_DC)
 {
        zend_object *zobj;
        zend_function *fbc;
        unsigned int lc_method_name_len;
-       char *lc_method_name;
+       zstr lc_method_name;
        zval *object = *object_ptr;
 
        /* FIXME: type is default */
@@ -747,7 +747,7 @@ static union _zend_function *zend_std_get_method(zval **object_ptr, char *method
 
        zobj = Z_OBJ_P(object);
        if (zend_u_hash_find(&zobj->ce->function_table, type, lc_method_name, lc_method_name_len+1, (void **)&fbc) == FAILURE) {
-               efree(lc_method_name);
+               efree(lc_method_name.v);
                if (zobj->ce->__call) {
                        zend_internal_function *call_user_call = emalloc(sizeof(zend_internal_function));
                        call_user_call->type = ZEND_INTERNAL_FUNCTION;
@@ -758,9 +758,9 @@ static union _zend_function *zend_std_get_method(zval **object_ptr, char *method
                        call_user_call->scope = zobj->ce;
                        call_user_call->fn_flags = 0;
                        if (UG(unicode)) {
-                               call_user_call->function_name = (char*)eustrndup((UChar*)method_name, method_len);
+                               call_user_call->function_name.u = eustrndup(method_name.u, method_len);
                        } else {
-                               call_user_call->function_name = estrndup(method_name, method_len);
+                               call_user_call->function_name.s = estrndup(method_name.s, method_len);
                        }
                        call_user_call->pass_rest_by_reference = 0;
                        call_user_call->return_reference = ZEND_RETURN_VALUE;
@@ -792,34 +792,34 @@ static union _zend_function *zend_std_get_method(zval **object_ptr, char *method
                 */
                updated_fbc = zend_check_private_int(fbc, Z_OBJ_HANDLER_P(object, get_class_entry)(object TSRMLS_CC), lc_method_name, method_len TSRMLS_CC);
                if (!updated_fbc) {
-                       zend_error(E_ERROR, "Call to %s method %v::%v() from context '%v'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR);
+                       zend_error(E_ERROR, "Call to %s method %v::%v() from context '%v'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR);
                }
                fbc = updated_fbc;
        } else if ((fbc->common.fn_flags & ZEND_ACC_PROTECTED)) {
                /* Ensure that if we're calling a protected function, we're allowed to do so.
                 */
                if (!zend_check_protected(fbc->common.scope, EG(scope))) {
-                       zend_error(E_ERROR, "Call to %s method %v::%v() from context '%v'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR);
+                       zend_error(E_ERROR, "Call to %s method %v::%v() from context '%v'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR);
                }
        }
 
-       efree(lc_method_name);
+       efree(lc_method_name.v);
        return fbc;
 }
 
 
 /* This is not (yet?) in the API, but it belongs in the built-in objects callbacks */
-ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC)
+ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zstr function_name_strval, int function_name_strlen TSRMLS_DC)
 {
        zend_function *fbc;
        /* FIXME: type is default */
        zend_uchar type = UG(unicode)?IS_UNICODE:IS_STRING;
 
        if (zend_u_hash_find(&ce->function_table, type, function_name_strval, function_name_strlen+1, (void **) &fbc)==FAILURE) {
-               char *class_name = ce->name;
+               zstr class_name = ce->name;
 
-               if (!class_name) {
-                       class_name = (char*)EMPTY_STR;
+               if (!class_name.v) {
+                       class_name.u = EMPTY_STR;
                }
                zend_error(E_ERROR, "Call to undefined method %R::%R()", type, class_name, type, function_name_strval);
        }
@@ -839,14 +839,14 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, char *f
                 */
                updated_fbc = zend_check_private_int(fbc, EG(scope), function_name_strval, function_name_strlen TSRMLS_CC);
                if (!updated_fbc) {
-                       zend_error(E_ERROR, "Call to %s method %v::%v() from context '%v'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), fbc->common.function_name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR);
+                       zend_error(E_ERROR, "Call to %s method %v::%v() from context '%v'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), fbc->common.function_name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR);
                }
                fbc = updated_fbc;
        } else if ((fbc->common.fn_flags & ZEND_ACC_PROTECTED)) {
                /* Ensure that if we're calling a protected function, we're allowed to do so.
                 */
                if (!zend_check_protected(EG(scope), fbc->common.scope)) {
-                       zend_error(E_ERROR, "Call to %s method %v::%v() from context '%v'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), fbc->common.function_name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR);
+                       zend_error(E_ERROR, "Call to %s method %v::%v() from context '%v'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), fbc->common.function_name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR);
                }
        }
 
@@ -854,7 +854,7 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, char *f
 }
 
 
-ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, zend_uchar type, void *property_name, int property_name_len, zend_bool silent TSRMLS_DC)
+ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, zend_uchar type, zstr property_name, int property_name_len, zend_bool silent TSRMLS_DC)
 {
        zval **retval = NULL;
        zend_class_entry *tmp_ce = ce;
@@ -865,7 +865,7 @@ ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, zend_uchar ty
                std_property_info.flags = ZEND_ACC_PUBLIC;
                std_property_info.name = property_name;
                std_property_info.name_length = property_name_len;
-               std_property_info.h = zend_get_hash_value(std_property_info.name, std_property_info.name_length+1);
+               std_property_info.h = zend_u_get_hash_value(UG(unicode)?IS_UNICODE:IS_STRING, std_property_info.name, std_property_info.name_length+1);
                property_info = &std_property_info;
        }
 
@@ -896,7 +896,7 @@ ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, zend_uchar ty
 }
 
 
-ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_uchar type, void *property_name, int property_name_len TSRMLS_DC)
+ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_uchar type, zstr property_name, int property_name_len TSRMLS_DC)
 {
        zend_error(E_ERROR, "Attempt to unset static property %v::$%R", ce->name, type, property_name);
        return 0;
@@ -915,13 +915,13 @@ static union _zend_function *zend_std_get_constructor(zval *object TSRMLS_DC)
                        /* Ensure that if we're calling a private function, we're allowed to do so.
                         */
                        if (Z_OBJ_HANDLER_P(object, get_class_entry)(object TSRMLS_CC) != EG(scope)) {
-                               zend_error(E_ERROR, "Call to private %v::%v() from context '%v'", constructor->common.scope->name, constructor->common.function_name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR);
+                               zend_error(E_ERROR, "Call to private %v::%v() from context '%v'", constructor->common.scope->name, constructor->common.function_name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR);
                        }
                } else if ((constructor->common.fn_flags & ZEND_ACC_PROTECTED)) {
                        /* Ensure that if we're calling a protected function, we're allowed to do so.
                         */
                        if (!zend_check_protected(constructor->common.scope, EG(scope))) {
-                               zend_error(E_ERROR, "Call to protected %v::%v() from context '%v'", constructor->common.scope->name, constructor->common.function_name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR);
+                               zend_error(E_ERROR, "Call to protected %v::%v() from context '%v'", constructor->common.scope->name, constructor->common.function_name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR);
                        }
                }
        }
@@ -1029,7 +1029,7 @@ zend_class_entry *zend_std_object_get_class(zval *object TSRMLS_DC)
        return zobj->ce;
 }
 
-int zend_std_object_get_class_name(zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC)
+int zend_std_object_get_class_name(zval *object, zstr *class_name, zend_uint *class_name_len, int parent TSRMLS_DC)
 {
        zend_object *zobj;
        zend_class_entry *ce;
@@ -1046,9 +1046,9 @@ int zend_std_object_get_class_name(zval *object, char **class_name, zend_uint *c
 
        *class_name_len = ce->name_length;
        if (UG(unicode)) {
-               *class_name = (char*)eustrndup((UChar*)ce->name, ce->name_length);
+               class_name->u = eustrndup(ce->name.u, ce->name_length);
        } else {
-               *class_name = estrndup(ce->name, ce->name_length);
+               class_name->s = estrndup(ce->name.s, ce->name_length);
        }
        return SUCCESS;
 }
index ebf66f32577648c16cd43004ec3f627fb3b7dadb..cde3e58e95dc6bf709b7fbd36e049e615c2500f4 100644 (file)
@@ -84,8 +84,8 @@ typedef HashTable *(*zend_object_get_properties_t)(zval *object TSRMLS_DC);
 /* args on stack! */
 /* Andi - EX(fbc) (function being called) needs to be initialized already in the INIT fcall opcode so that the parameters can be parsed the right way. We need to add another callback for this.
  */
-typedef int (*zend_object_call_method_t)(char *method, INTERNAL_FUNCTION_PARAMETERS);
-typedef union _zend_function *(*zend_object_get_method_t)(zval **object_ptr, char *method, int method_len TSRMLS_DC);
+typedef int (*zend_object_call_method_t)(zstr method, INTERNAL_FUNCTION_PARAMETERS);
+typedef union _zend_function *(*zend_object_get_method_t)(zval **object_ptr, zstr method, int method_len TSRMLS_DC);
 typedef union _zend_function *(*zend_object_get_constructor_t)(zval *object TSRMLS_DC);
 
 /* Object maintenance/destruction */
@@ -95,7 +95,7 @@ typedef void (*zend_object_delete_obj_t)(zval *object TSRMLS_DC);
 typedef zend_object_value (*zend_object_clone_obj_t)(zval *object TSRMLS_DC);
 
 typedef zend_class_entry *(*zend_object_get_class_entry_t)(zval *object TSRMLS_DC);
-typedef int (*zend_object_get_class_name_t)(zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC);
+typedef int (*zend_object_get_class_name_t)(zval *object, zstr *class_name, zend_uint *class_name_len, int parent TSRMLS_DC);
 typedef int (*zend_object_compare_t)(zval *object1, zval *object2 TSRMLS_DC);
 
 /* Cast an object to some other type
@@ -137,9 +137,9 @@ struct _zend_object_handlers {
 extern ZEND_API zend_object_handlers std_object_handlers;
 
 BEGIN_EXTERN_C()
-ZEND_API union _zend_function *zend_std_get_static_method(zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC);
-ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, zend_uchar type, void *property_name, int property_name_len, zend_bool silent TSRMLS_DC);
-ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_uchar type, void *property_name, int property_name_len TSRMLS_DC);
+ZEND_API union _zend_function *zend_std_get_static_method(zend_class_entry *ce, zstr function_name_strval, int function_name_strlen TSRMLS_DC);
+ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, zend_uchar type, zstr property_name, int property_name_len, zend_bool silent TSRMLS_DC);
+ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_uchar type, zstr property_name, int property_name_len TSRMLS_DC);
 ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zval *member, int silent TSRMLS_DC);
 
 ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int type TSRMLS_DC);
@@ -148,11 +148,11 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty
 #define IS_ZEND_STD_OBJECT(z)  (Z_TYPE(z) == IS_OBJECT && (Z_OBJ_HT((z))->get_class_entry != NULL))
 #define HAS_CLASS_ENTRY(z) (Z_OBJ_HT(z)->get_class_entry != NULL)
 
-ZEND_API int zend_check_private(union _zend_function *fbc, zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC);
+ZEND_API int zend_check_private(union _zend_function *fbc, zend_class_entry *ce, zstr function_name_strval, int function_name_strlen TSRMLS_DC);
 
 ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope);
 
-ZEND_API int zend_check_property_access(zend_object *zobj, zend_uchar utype, void *prop_info_name TSRMLS_DC);
+ZEND_API int zend_check_property_access(zend_object *zobj, zend_uchar utype, zstr prop_info_name TSRMLS_DC);
 
 ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS);
 END_EXTERN_C()
index 0e5e27b6d9f00d23d27c59fb1cf3b313ffd411b2..1d10f57e857c35092f1bdf3365e6a5bf97d572eb 100644 (file)
@@ -44,7 +44,7 @@ ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handl
                                        zend_error(EG(in_execution) ? E_ERROR : E_WARNING,
                                                "Call to private %v::__destruct() from context '%v'%s",
                                                ce->name,
-                                               EG(scope) ? EG(scope)->name : (char*)EMPTY_STR,
+                                               EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR,
                                                EG(in_execution) ? "" : " during shutdown ignored");
                                        return;
                                }
@@ -57,7 +57,7 @@ ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handl
                                        zend_error(EG(in_execution) ? E_ERROR : E_WARNING,
                                                "Call to protected %v::__destruct() from context '%v'%s",
                                                ce->name,
-                                               EG(scope) ? EG(scope)->name : (char*)EMPTY_STR,
+                                               EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR,
                                                EG(in_execution) ? "" : " during shutdown ignored");
                                        return;
                                }
index b80bae90c6fbb6dcbbd7bfc3d7617e77ab2f9e02..a5fffc0773d3c6142f4510ab1f30d44378db2112 100644 (file)
@@ -75,7 +75,7 @@ void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_siz
 
        op_array->T = 0;
 
-       op_array->function_name = NULL;
+       op_array->function_name.v = NULL;
        op_array->filename = zend_get_compiled_filename(TSRMLS_C);
        op_array->script_encoding = zend_get_compiled_script_encoding(TSRMLS_C);
        op_array->doc_comment = NULL;
@@ -171,7 +171,7 @@ ZEND_API void destroy_zend_class(zend_class_entry **pce)
                        zend_hash_destroy(&ce->default_properties);
                        zend_hash_destroy(&ce->properties_info);
                        zend_hash_destroy(&ce->default_static_members);
-                       efree(ce->name);
+                       efree(ce->name.v);
                        zend_hash_destroy(&ce->function_table);
                        zend_hash_destroy(&ce->constants_table);
                        if (ce->num_interfaces > 0 && ce->interfaces) {
@@ -186,7 +186,7 @@ ZEND_API void destroy_zend_class(zend_class_entry **pce)
                        zend_hash_destroy(&ce->default_properties);
                        zend_hash_destroy(&ce->properties_info);
                        zend_hash_destroy(&ce->default_static_members);
-                       free(ce->name);
+                       free(ce->name.v);
                        zend_hash_destroy(&ce->function_table);
                        zend_hash_destroy(&ce->constants_table);
                        if (ce->num_interfaces > 0) {
@@ -226,7 +226,7 @@ ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC)
                i = op_array->last_var;
                while (i > 0) {
                        i--;
-                       efree(op_array->vars[i].name);
+                       efree(op_array->vars[i].name.v);
                }
                efree(op_array->vars);
        }
@@ -248,8 +248,8 @@ ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC)
        }
        efree(op_array->opcodes);
 
-       if (op_array->function_name) {
-               efree(op_array->function_name);
+       if (op_array->function_name.v) {
+               efree(op_array->function_name.v);
        }
        if (op_array->doc_comment) {
                efree(op_array->doc_comment);
@@ -265,9 +265,9 @@ ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC)
        }
        if (op_array->arg_info) {
                for (i=0; i<op_array->num_args; i++) {
-                       efree(op_array->arg_info[i].name);
-                       if (op_array->arg_info[i].class_name) {
-                               efree(op_array->arg_info[i].class_name);
+                       efree(op_array->arg_info[i].name.v);
+                       if (op_array->arg_info[i].class_name.v) {
+                               efree(op_array->arg_info[i].class_name.v);
                        }
                }
                efree(op_array->arg_info);
index 19fdc486978a75a8129395ef7c75ef9a04b656b3..7648d0f4cf0efd386bfe28b621897c3a6efdff33 100644 (file)
@@ -621,7 +621,6 @@ ZEND_API void _convert_to_unicode(zval *op TSRMLS_DC ZEND_FILE_LINE_DC)
                        break;
                case IS_RESOURCE: {
                        long tmp = Z_LVAL_P(op);
-                       TSRMLS_FETCH();
 
                        zend_list_delete(Z_LVAL_P(op));
                        Z_USTRVAL_P(op) = eumalloc_rel(sizeof("Resource id #")-1 + MAX_LENGTH_OF_LONG + 1);
@@ -629,20 +628,16 @@ ZEND_API void _convert_to_unicode(zval *op TSRMLS_DC ZEND_FILE_LINE_DC)
                        break;
                }
                case IS_LONG: {
-                       int32_t capacity = MAX_LENGTH_OF_LONG + 1;
                        long lval = Z_LVAL_P(op);
 
-                       Z_USTRVAL_P(op) = eumalloc_rel(capacity);
+                       Z_USTRVAL_P(op) = eumalloc_rel(MAX_LENGTH_OF_LONG + 1);
                        Z_USTRLEN_P(op) = u_sprintf(Z_USTRVAL_P(op), "%ld", lval);
                        break;
            }
                case IS_DOUBLE: {
-                       int32_t capacity;
                        double dval = Z_DVAL_P(op);
-                       TSRMLS_FETCH();
 
-                       capacity = MAX_LENGTH_OF_DOUBLE + EG(precision) + 1;
-                       Z_USTRVAL_P(op) = eumalloc_rel(capacity);
+                       Z_USTRVAL_P(op) = eumalloc_rel(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1);
                        Z_USTRLEN_P(op) = u_sprintf(Z_USTRVAL_P(op), "%.*G", (int) EG(precision), dval);
                        break;
                }
@@ -653,8 +648,6 @@ ZEND_API void _convert_to_unicode(zval *op TSRMLS_DC ZEND_FILE_LINE_DC)
                        Z_USTRLEN_P(op) = sizeof("Array")-1;
                        break;
                case IS_OBJECT: {
-                       TSRMLS_FETCH();
-
                        convert_object_to_type(op, IS_UNICODE, convert_to_unicode);
 
                        if (Z_TYPE_P(op) == IS_UNICODE) {
@@ -1351,7 +1344,7 @@ ZEND_API int add_string_to_string(zval *result, zval *op1, zval *op2)
        assert(Z_TYPE_P(op1) == Z_TYPE_P(op2));
 
        if (Z_TYPE_P(op1) == IS_UNICODE) {
-               int32_t length = Z_USTRLEN_P(op1) + Z_USTRLEN_P(op2);
+               int length = Z_USTRLEN_P(op1) + Z_USTRLEN_P(op2);
 
                Z_USTRVAL_P(result) = eurealloc(Z_USTRVAL_P(op1), length+1);
                u_memcpy(Z_USTRVAL_P(result)+Z_USTRLEN_P(op1), Z_USTRVAL_P(op2), Z_USTRLEN_P(op2));
@@ -2077,11 +2070,11 @@ ZEND_API char *zend_str_tolower_dup(const char *source, unsigned int length)
        return zend_str_tolower_copy((char *)emalloc(length+1), source, length);
 }
 
-ZEND_API void *zend_u_str_tolower_copy(zend_uchar type, void *dest, const void *source, unsigned int length)
+ZEND_API zstr zend_u_str_tolower_copy(zend_uchar type, zstr dest, zstr source, unsigned int length)
 {
        if (type == IS_UNICODE) {
-               register UChar *str = (UChar*)source;
-               register UChar *result = (UChar*)dest;
+               register UChar *str = source.u;
+               register UChar *result = dest.u;
                register UChar *end = str + length;
 
                while (str < end) {
@@ -2091,16 +2084,16 @@ ZEND_API void *zend_u_str_tolower_copy(zend_uchar type, void *dest, const void *
 
                return dest;
        } else {
-               return zend_str_tolower_copy(dest, source, length);
+               return (zstr)zend_str_tolower_copy(dest.s, source.s, length);
        }
 }
 
-ZEND_API void *zend_u_str_tolower_dup(zend_uchar type, const void *source, unsigned int length)
+ZEND_API zstr zend_u_str_tolower_dup(zend_uchar type, zstr source, unsigned int length)
 {
        if (type == IS_UNICODE) {
-               return zend_u_str_tolower_copy(IS_UNICODE, emalloc(UBYTES(length+1)), source, length);
+               return zend_u_str_tolower_copy(IS_UNICODE, (zstr)emalloc(UBYTES(length+1)), source, length);
        } else {
-               return zend_str_tolower_copy((char*)emalloc(length+1), (char*)source, length);
+               return (zstr)zend_str_tolower_copy((char*)emalloc(length+1), source.s, length);
        }
 }
 
@@ -2115,9 +2108,9 @@ ZEND_API void zend_str_tolower(char *str, unsigned int length)
        }
 }
 
-ZEND_API void zend_u_str_tolower(zend_uchar type, void *str, unsigned int length) {
+ZEND_API void zend_u_str_tolower(zend_uchar type, zstr str, unsigned int length) {
        if (type == IS_UNICODE) {
-               register UChar *p = (UChar*)str;
+               register UChar *p = str.u;
                register UChar *end = p + length;
 
                while (p < end) {
@@ -2125,29 +2118,29 @@ ZEND_API void zend_u_str_tolower(zend_uchar type, void *str, unsigned int length
                        p++;
                }
        } else {
-               zend_str_tolower((char*)str, length);
+               zend_str_tolower(str.s, length);
        }
 }
 
-ZEND_API void *zend_u_str_case_fold(zend_uchar type, const void *source, unsigned int length, zend_bool normalize, unsigned int *new_len)
+ZEND_API zstr zend_u_str_case_fold(zend_uchar type, zstr source, unsigned int length, zend_bool normalize, unsigned int *new_len)
 {
        if (type == IS_UNICODE) {
                UChar *ret;
-               int32_t ret_len;
+               int ret_len;
 
                if (normalize) {
-                       zend_normalize_identifier(&ret, &ret_len, (UChar*)source, length, 1);
+                       zend_normalize_identifier(&ret, &ret_len, source.u, length, 1);
                } else {
                        UErrorCode status = U_ZERO_ERROR;
 
-                       zend_case_fold_string(&ret, &ret_len, (UChar*)source, length, U_FOLD_CASE_DEFAULT, &status);
+                       zend_case_fold_string(&ret, &ret_len, source.u, length, U_FOLD_CASE_DEFAULT, &status);
                }
 
                *new_len = ret_len;
-               return ret;
+               return (zstr)ret;
        } else {
                *new_len = length;
-               return zend_str_tolower_dup(source, length);
+               return (zstr)zend_str_tolower_dup(source.s, length);
        }
 }
 
@@ -2164,9 +2157,9 @@ ZEND_API int zend_binary_strcmp(char *s1, uint len1, char *s2, uint len2)
 }
 
 
-ZEND_API int zend_u_binary_strcmp(UChar *s1, int32_t len1, UChar *s2, int32_t len2)
+ZEND_API int zend_u_binary_strcmp(UChar *s1, int len1, UChar *s2, int len2)
 {
-       int32_t result = u_strCompare(s1, len1, s2, len2, 1);
+       int result = u_strCompare(s1, len1, s2, len2, 1);
        return ZEND_NORMALIZE_BOOL(result);
 }
 
@@ -2184,11 +2177,11 @@ ZEND_API int zend_binary_strncmp(char *s1, uint len1, char *s2, uint len2, uint
 }
 
 
-ZEND_API int zend_u_binary_strncmp(UChar *s1, int32_t len1, UChar *s2, int32_t len2, uint length)
+ZEND_API int zend_u_binary_strncmp(UChar *s1, int len1, UChar *s2, int len2, uint length)
 {
        int32_t off1 = 0, off2 = 0;
        UChar32 c1, c2;
-       int32_t result = 0;
+       int result = 0;
 
        for( ; length > 0; --length) {
                if (off1 >= len1 || off2 >= len2) {
@@ -2226,10 +2219,10 @@ ZEND_API int zend_binary_strcasecmp(char *s1, uint len1, char *s2, uint len2)
 }
 
 
-ZEND_API int zend_u_binary_strcasecmp(UChar *s1, int32_t len1, UChar *s2, int32_t len2)
+ZEND_API int zend_u_binary_strcasecmp(UChar *s1, int len1, UChar *s2, int len2)
 {
        UErrorCode status = U_ZERO_ERROR;
-       int32_t result = u_strCaseCompare(s1, len1, s2, len2, U_COMPARE_CODE_POINT_ORDER, &status);
+       int result = u_strCaseCompare(s1, len1, s2, len2, U_COMPARE_CODE_POINT_ORDER, &status);
        return ZEND_NORMALIZE_BOOL(result);
 }
 
@@ -2258,11 +2251,11 @@ ZEND_API int zend_binary_strncasecmp(char *s1, uint len1, char *s2, uint len2, u
  * codepoints to compare, we take a hit upfront by iterating over both strings
  * until we find them. Then we can simply use u_strCaseCompare().
  */
-ZEND_API int zend_u_binary_strncasecmp(UChar *s1, int32_t len1, UChar *s2, int32_t len2, uint length)
+ZEND_API int zend_u_binary_strncasecmp(UChar *s1, int len1, UChar *s2, int len2, uint length)
 {
        UErrorCode status = U_ZERO_ERROR;
        int32_t off1 = 0, off2 = 0;
-       int32_t result;
+       int result;
 
        U16_FWD_N(s1, off1, len1, length);
        U16_FWD_N(s2, off2, len2, length);
@@ -2433,7 +2426,7 @@ ZEND_API void zend_locale_usprintf_double(zval *op ZEND_FILE_LINE_DC)
 {
        double dval = Z_DVAL_P(op);
        UFILE *strf;
-       int32_t capacity;
+       int capacity;
 
        TSRMLS_FETCH();
 
@@ -2460,7 +2453,7 @@ ZEND_API void zend_locale_usprintf_long(zval *op ZEND_FILE_LINE_DC)
 {
        long lval = Z_LVAL_P(op);
        UFILE *strf;
-       int32_t capacity;
+       int capacity;
 
        capacity = MAX_LENGTH_OF_LONG + 1;
        Z_USTRVAL_P(op) = eumalloc_rel(capacity);
index 75acb8a0330e145a59896730c25e2851be7ddb97..2edb1609d719eb2cf83156e17c71e27a6f345965 100644 (file)
@@ -137,9 +137,9 @@ static inline zend_uchar is_numeric_string(char *str, int length, long *lval, do
        return 0;
 }
 
-static inline zend_uchar is_numeric_unicode(UChar *str, int32_t length, long *lval, double *dval, zend_bool allow_errors)
+static inline zend_uchar is_numeric_unicode(UChar *str, int length, long *lval, double *dval, zend_bool allow_errors)
 {
-       int32_t local_lval;
+       long local_lval;
        double local_dval;
        UChar *end_ptr_long, *end_ptr_double;
        int conv_base=10;
@@ -203,7 +203,7 @@ static inline zend_uchar is_numeric_unicode(UChar *str, int32_t length, long *lv
 }
 
 static inline UChar*
-zend_u_memnstr(UChar *haystack, UChar *needle, int32_t needle_len, UChar *end)
+zend_u_memnstr(UChar *haystack, UChar *needle, int needle_len, UChar *end)
 {
        return u_strFindFirst(haystack, end - haystack, needle, needle_len);
 }
@@ -275,11 +275,11 @@ ZEND_API void zend_str_tolower(char *str, unsigned int length);
 ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, unsigned int length);
 ZEND_API char *zend_str_tolower_dup(const char *source, unsigned int length);
 
-ZEND_API void zend_u_str_tolower(zend_uchar type, void *str, unsigned int length);
-ZEND_API void *zend_u_str_tolower_copy(zend_uchar type, void *dest, const void *source, unsigned int length);
-ZEND_API void *zend_u_str_tolower_dup(zend_uchar type, const void *source, unsigned int length);
+ZEND_API void zend_u_str_tolower(zend_uchar type, zstr str, unsigned int length);
+ZEND_API zstr zend_u_str_tolower_copy(zend_uchar type, zstr dest, zstr source, unsigned int length);
+ZEND_API zstr zend_u_str_tolower_dup(zend_uchar type, zstr source, unsigned int length);
 
-ZEND_API void *zend_u_str_case_fold(zend_uchar type, const void *source, unsigned int length, zend_bool normalize, unsigned int *new_len);
+ZEND_API zstr zend_u_str_case_fold(zend_uchar type, zstr source, unsigned int length, zend_bool normalize, unsigned int *new_len);
 
 ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2);
 ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3);
@@ -291,10 +291,10 @@ ZEND_API int zend_binary_strcasecmp(char *s1, uint len1, char *s2, uint len2);
 ZEND_API int zend_binary_strncasecmp(char *s1, uint len1, char *s2, uint len2, uint length);
 
 ZEND_API int zend_u_binary_zval_strcmp(zval *s1, zval *s2);
-ZEND_API int zend_u_binary_strcmp(UChar *s1, int32_t len1, UChar *s2, int32_t len2);
-ZEND_API int zend_u_binary_strncmp(UChar *s1, int32_t len1, UChar *s2, int32_t len2, uint length);
-ZEND_API int zend_u_binary_strcasecmp(UChar *s1, int32_t len1, UChar *s2, int32_t len2);
-ZEND_API int zend_u_binary_strncasecmp(UChar *s1, int32_t len1, UChar *s2, int32_t len2, uint length);
+ZEND_API int zend_u_binary_strcmp(UChar *s1, int len1, UChar *s2, int len2);
+ZEND_API int zend_u_binary_strncmp(UChar *s1, int len1, UChar *s2, int len2, uint length);
+ZEND_API int zend_u_binary_strcasecmp(UChar *s1, int len1, UChar *s2, int len2);
+ZEND_API int zend_u_binary_strncasecmp(UChar *s1, int len1, UChar *s2, int len2, uint length);
 
 ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2);
 ZEND_API void zendi_u_smart_strcmp(zval *result, zval *s1, zval *s2);
@@ -388,8 +388,8 @@ END_EXTERN_C()
 #define Z_OBJPROP(zval)                        Z_OBJ_HT((zval))->get_properties(&(zval) TSRMLS_CC)
 #define Z_OBJ_HANDLER(zval, hf) Z_OBJ_HT((zval))->hf
 #define Z_RESVAL(zval)                 (zval).value.lval
-#define Z_UNIVAL(zval)                 (Z_TYPE(zval)==IS_UNICODE?(char*)Z_USTRVAL(zval):Z_STRVAL(zval))
-#define Z_UNILEN(zval)                 (Z_TYPE(zval)==IS_UNICODE?Z_USTRLEN(zval):Z_STRLEN(zval))
+#define Z_UNIVAL(zval)                 ((zstr)(Z_STRVAL(zval)))
+#define Z_UNILEN(zval)                 Z_STRLEN(zval)
 
 #define Z_LVAL_P(zval_p)               Z_LVAL(*zval_p)
 #define Z_BVAL_P(zval_p)               Z_BVAL(*zval_p)
index 9a56cac1071bae174ad0c90114aafc6bc98d7ce8..7f3855fd44d788be26896b1fa194369e97cd230d 100644 (file)
@@ -55,7 +55,7 @@ zend_u_strtol(nptr, endptr, base)
        register UChar c;
        register unsigned long cutoff;
        register int neg = 0, any, cutlim;
-       register int32_t val;
+       register int val;
 
        /*
         * Skip white space and pick up leading +/- sign if any.
index 6ba617d64aff932c20485f62887a2c23b30d0a4e..4432c3498e18dfa5e2c5471bf4cf3c3bd0e2e888 100644 (file)
@@ -29,39 +29,6 @@ ZEND_API ts_rsrc_id unicode_globals_id;
 ZEND_API zend_unicode_globals unicode_globals;
 #endif
 
-static void zend_from_unicode_substitute_cb(
-        const void *context,
-        UConverterFromUnicodeArgs *toUArgs,
-        const char *codeUnits,
-        int32_t length,
-        UConverterCallbackReason reason,
-        UErrorCode *err
-    )
-{
-    if (context == NULL) {
-        if (reason > UCNV_IRREGULAR)
-        {
-            return;
-        }
-
-        *err = U_ZERO_ERROR;
-        //ucnv_cbFromUWriteSub(fromArgs, 0, err);
-        return;
-    } else if (*((char*)context)=='i') {
-        if (reason != UCNV_UNASSIGNED)
-        {
-            /* the caller must have set
-             * the error code accordingly
-             */
-            return;
-        } else {
-            *err = U_ZERO_ERROR;
-            //ucnv_cbFromUWriteSub(fromArgs, 0, err);
-            return;
-        }
-    }
-}
-
 /* {{{ zend_set_converter_error_mode */
 void zend_set_converter_error_mode(UConverter *conv, uint8_t error_mode)
 {
@@ -178,7 +145,7 @@ int zend_copy_converter(UConverter **target, UConverter *source)
 /* }}} */
 
 /* {{{ zend_convert_to_unicode */
-ZEND_API void zend_convert_to_unicode(UConverter *conv, UChar **target, int32_t *target_len, const char *source, int32_t source_len, UErrorCode *status)
+ZEND_API void zend_convert_to_unicode(UConverter *conv, UChar **target, int *target_len, const char *source, int source_len, UErrorCode *status)
 {
     UChar *buffer = NULL;
     UChar *output;
@@ -530,7 +497,7 @@ static inline void zend_normalize_string(UChar **dest, int32_t *dest_len, UChar
 /* }}} */
 
 /* {{{ zend_case_fold_string */
-ZEND_API void zend_case_fold_string(UChar **dest, int32_t *dest_len, UChar *src, int32_t src_len, uint32_t options, UErrorCode *status)
+ZEND_API void zend_case_fold_string(UChar **dest, int *dest_len, UChar *src, int src_len, uint32_t options, UErrorCode *status)
 {
     UChar *buffer = NULL;
     int32_t buffer_len;
@@ -555,7 +522,7 @@ ZEND_API void zend_case_fold_string(UChar **dest, int32_t *dest_len, UChar *src,
 /* }}} */
 
 /* {{{ zend_normalize_identifier */
-ZEND_API int zend_normalize_identifier(UChar **dest, int32_t *dest_len, UChar *ident, int32_t ident_len, zend_bool fold_case)
+ZEND_API int zend_normalize_identifier(UChar **dest, int *dest_len, UChar *ident, int ident_len, zend_bool fold_case)
 {
     UChar *buffer = NULL;
     UChar *orig_ident = ident;
index 7154c377c9c243c0ec81b8d3e2726ba03664a4bc..91ea26cad81df0279f32384ec4635ce25df6966d 100644 (file)
@@ -42,7 +42,7 @@ void zend_set_converter_error_mode(UConverter *conv, uint8_t error_mode);
 
 /* API functions */
 
-ZEND_API void zend_convert_to_unicode(UConverter *conv, UChar **target, int32_t *target_len, const char *source, int32_t source_len, UErrorCode *status);
+ZEND_API void zend_convert_to_unicode(UConverter *conv, UChar **target, int *target_len, const char *source, int source_len, UErrorCode *status);
 ZEND_API void zend_convert_from_unicode(UConverter *conv, char **target, int32_t *target_len, const UChar *source, int32_t source_len, UErrorCode *status);
 ZEND_API void zend_convert_encodings(UConverter *target_conv, UConverter *source_conv, char **target, int32_t *target_len, const char *source, int32_t source_len, UErrorCode *status);
 ZEND_API int zval_string_to_unicode_ex(zval *string, UConverter *conv);
@@ -52,10 +52,10 @@ ZEND_API int zval_unicode_to_string(zval *string, UConverter *conv TSRMLS_DC);
 ZEND_API int zend_cmp_unicode_and_string(UChar *ustr, char* str, uint len);
 ZEND_API int zend_cmp_unicode_and_literal(UChar *ustr, int32_t ulen, char* str, int32_t slen);
 
-ZEND_API void zend_case_fold_string(UChar **dest, int32_t *dest_len, UChar *src, int32_t src_len, uint32_t options, UErrorCode *status);
+ZEND_API void zend_case_fold_string(UChar **dest, int *dest_len, UChar *src, int src_len, uint32_t options, UErrorCode *status);
 
 ZEND_API int zend_is_valid_identifier(UChar *ident, int32_t ident_len);
-ZEND_API int zend_normalize_identifier(UChar **dest, int32_t *dest_len, UChar *ident, int32_t ident_len, zend_bool fold_case);
+ZEND_API int zend_normalize_identifier(UChar **dest, int *dest_len, UChar *ident, int ident_len, zend_bool fold_case);
 
 /*
  * Function to get a codepoint at position n. Iterates over codepoints starting from the
@@ -94,7 +94,7 @@ static inline int zend_codepoint_to_uchar(UChar32 codepoint, UChar *buf)
 
 #define USTR_FREE(ustr) do { if (ustr) { efree(ustr); } } while (0);
 #define UBYTES(len) ((len) * sizeof(UChar))
-#define USTR_LEN(str) (UG(unicode)?u_strlen((UChar*)(str)):strlen((char*)(str)))
+#define USTR_LEN(str) (UG(unicode)?u_strlen((str).u):strlen((str).s))
 
 #define USTR_MAKE(cs) zend_ascii_to_unicode(cs, sizeof(cs) ZEND_FILE_LINE_CC)
 #define USTR_MAKE_REL(cs) zend_ascii_to_unicode(cs, sizeof(cs) ZEND_FILE_LINE_RELAY_CC)
index 352865e99d4997f40ca0e537926b5f710dd9dc67..5f6165652912d01aa7568070c3c4855dba53514e 100644 (file)
@@ -1657,7 +1657,7 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
 {
        zend_op *opline = EX(opline);
        zval *function_name;
-       char *function_name_strval;
+       zstr function_name_strval;
        int function_name_strlen;
        zend_free_op free_op1, free_op2;
        /* FIXME: type is default */
@@ -1720,7 +1720,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, ANY, CONST|TMP|VAR|UNUSED|CV)
 
        ce = EX_T(opline->op1.u.var).class_entry;
        if(OP2_TYPE != IS_UNUSED) {
-               char *function_name_strval;
+               zstr function_name_strval;
                unsigned int function_name_strlen;
                zend_bool is_const = (OP2_TYPE == IS_CONST);
                zend_free_op free_op2;
@@ -1740,7 +1740,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, ANY, CONST|TMP|VAR|UNUSED|CV)
                EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
 
                if (!is_const) {
-                       efree(function_name_strval);
+                       efree(function_name_strval.v);
                        FREE_OP2();
                }
        } else {
@@ -1766,7 +1766,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
        zend_op *opline = EX(opline);
        zval *function_name;
        zend_function *function;
-       void *function_name_strval, *lcname;
+       zstr function_name_strval, lcname;
        unsigned int function_name_strlen, lcname_len;
        zend_free_op free_op2;
 
@@ -1784,13 +1784,13 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
        function_name_strval = Z_UNIVAL_P(function_name);
        function_name_strlen = Z_UNILEN_P(function_name);
 
-       lcname = zend_u_str_case_fold(Z_TYPE_P(function_name), Z_STRVAL_P(function_name), function_name_strlen, 1, &lcname_len);
+       lcname = zend_u_str_case_fold(Z_TYPE_P(function_name), Z_UNIVAL_P(function_name), function_name_strlen, 1, &lcname_len);
        if (zend_u_hash_find(EG(function_table), Z_TYPE_P(function_name), lcname, lcname_len+1, (void **) &function)==FAILURE) {
-               efree(lcname);
+               efree(lcname.v);
                zend_error_noreturn(E_ERROR, "Call to undefined function %R()", Z_TYPE_P(function_name), function_name_strval);
        }
 
-       efree(lcname);
+       efree(lcname.v);
        if (OP2_TYPE != IS_CONST) {
                FREE_OP2();
        }
@@ -1820,8 +1820,8 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
                        ZEND_VM_NEXT_OPCODE(); /* Never reached */
                }
                if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) {
-                       zend_error(E_NOTICE, "Function %s%s%s() is deprecated",
-                               EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : "",
+                       zend_error(E_NOTICE, "Function %v%s%v() is deprecated",
+                               EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : (zstr)EMPTY_STR,
                                EX(function_state).function->common.scope ? "::" : "",
                                EX(function_state).function->common.function_name);
                }
@@ -1951,7 +1951,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
                }
 
                if (EX(function_state).function->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) {
-                       efree(EX(function_state).function->common.function_name);
+                       efree(EX(function_state).function->common.function_name.v);
                }
                efree(EX(fbc));
 
@@ -2068,7 +2068,7 @@ ZEND_VM_C_LABEL(return_by_value):
 
                if (EG(ze1_compatibility_mode) && Z_TYPE_P(retval_ptr) == IS_OBJECT) {
                        zval *ret;
-                       char *class_name;
+                       zstr class_name;
                        zend_uint class_name_len;
                        int dup;
 
@@ -2076,13 +2076,13 @@ ZEND_VM_C_LABEL(return_by_value):
                        INIT_PZVAL_COPY(ret, retval_ptr);
                        dup = zend_get_object_classname(retval_ptr, &class_name, &class_name_len TSRMLS_CC);
                        if (Z_OBJ_HT_P(retval_ptr)->clone_obj == NULL) {
-                               zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v",  Z_OBJCE_P(retval_ptr)->name);
+                               zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v",  class_name);
                        }
-                       zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", Z_OBJCE_P(retval_ptr)->name);
+                       zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name);
                        Z_OBJVAL_P(ret) = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC);
                        *EG(return_value_ptr_ptr) = ret;
                        if (!dup) {
-                               efree(class_name);
+                               efree(class_name.v);
                        }
                } else if (!IS_OP1_TMP_FREE()) { /* Not a temp var */
                        if (EG(active_op_array)->return_reference == ZEND_RETURN_REF ||
@@ -2291,7 +2291,7 @@ ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY)
 
        if (zend_ptr_stack_get_arg(arg_num, (void **) &param TSRMLS_CC)==FAILURE) {
                char *space;
-               char *class_name = get_active_class_name(&space TSRMLS_CC);
+               zstr class_name = get_active_class_name(&space TSRMLS_CC);
                zend_execute_data *ptr = EX(prev_execute_data);
 
                zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL TSRMLS_CC);
@@ -2509,13 +2509,13 @@ ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMP|VAR|UNUSED|CV, ANY)
                        /* Ensure that if we're calling a private function, we're allowed to do so.
                         */
                        if (ce != EG(scope)) {
-                               zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR);
+                               zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR);
                        }
                } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
                        /* Ensure that if we're calling a protected function, we're allowed to do so.
                         */
                        if (!zend_check_protected(clone->common.scope, EG(scope))) {
-                               zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR);
+                               zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR);
                        }
                }
        }
@@ -2873,7 +2873,7 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, ANY)
                                        for (i = 0; i < ex->op_array->last_var; i++) {
                                                if (ex->op_array->vars[i].hash_value == hash_value &&
                                                    ex->op_array->vars[i].name_len == Z_UNILEN_P(varname) &&
-                                                   !memcmp(ex->op_array->vars[i].name, Z_UNIVAL_P(varname), Z_TYPE_P(varname)==IS_UNICODE?UBYTES(Z_UNILEN_P(varname)):Z_UNILEN_P(varname))) {
+                                                   !memcmp(ex->op_array->vars[i].name.v, Z_UNIVAL_P(varname).v, Z_TYPE_P(varname)==IS_UNICODE?UBYTES(Z_UNILEN_P(varname)):Z_UNILEN_P(varname))) {
                                                        ex->CVs[i] = NULL;
                                                        break;
                                                }
@@ -2922,20 +2922,20 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
                                                break;
                                        case IS_STRING:
                                        case IS_UNICODE: {
-                                               void *offset_key = Z_UNIVAL_P(offset);
+                                               zstr offset_key = Z_UNIVAL_P(offset);
                                                int  offset_len  = Z_UNILEN_P(offset);
                                                int free_offset = 0;
 
                                                if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) {
                                                        /* Identifier normalization */
                                                        UChar *norm;
-                                                       int32_t norm_len;
+                                                       int norm_len;
 
                                                        if (!zend_normalize_identifier(&norm, &norm_len,
-                                                                                      (UChar*)offset_key, offset_len, 0)) {
-                                                               zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key);
-                                                       } else if ((char*)norm != offset_key) {
-                                                               offset_key = (char*)norm;
+                                                                                      offset_key.u, offset_len, 0)) {
+                                                               zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key.u);
+                                                       } else if (norm != offset_key.u) {
+                                                               offset_key.u = norm;
                                                                offset_len = norm_len;
                                                                free_offset = 1;
                                                        }
@@ -2953,7 +2953,7 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
                                                                        for (i = 0; i < ex->op_array->last_var; i++) {
                                                                                if (ex->op_array->vars[i].hash_value == hash_value &&
                                                                                    ex->op_array->vars[i].name_len == offset_len &&
-                                                                                   !memcmp(ex->op_array->vars[i].name, offset_key, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) {
+                                                                                   !memcmp(ex->op_array->vars[i].name.v, offset_key.v, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) {
                                                                                        ex->CVs[i] = NULL;
                                                                                        break;
                                                                                }
@@ -2962,7 +2962,7 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
                                                        }
                                                }
                                                if (free_offset) {
-                                                       efree(offset_key);
+                                                       efree(offset_key.v);
                                                }
                                                break;
                                        }
@@ -3131,7 +3131,7 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY)
                if (ce) {
                        zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC);
                        while (zend_hash_has_more_elements(fe_ht) == SUCCESS) {
-                               char *str_key;
+                               zstr str_key;
                                uint str_key_len;
                                ulong int_key;
                                zend_uchar key_type;
@@ -3168,7 +3168,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
        zend_free_op free_op1;
        zval *array = GET_OP1_ZVAL_PTR(BP_VAR_R);
        zval **value;
-       char *str_key;
+       zstr str_key;
        uint str_key_len;
        ulong int_key;
        HashTable *fe_ht;
@@ -3185,7 +3185,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
                        ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.u.opline_num);
 
                case ZEND_ITER_PLAIN_OBJECT: {
-                       char *class_name, *prop_name;
+                       zstr class_name, prop_name;
                        zend_object *zobj = zend_objects_get_address(array TSRMLS_CC);
 
                        fe_ht = HASH_OF(array);
@@ -3201,11 +3201,11 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
                        if (use_key) {
                                zend_u_unmangle_property_name(key_type == HASH_KEY_IS_UNICODE?IS_UNICODE:IS_STRING, str_key, &class_name, &prop_name);
                                if (key_type == HASH_KEY_IS_UNICODE) {
-                                       str_key_len = u_strlen((UChar*)prop_name);
-                                       str_key = (char*)eustrndup((UChar*)prop_name, str_key_len);
+                                       str_key_len = u_strlen(prop_name.u);
+                                       str_key.u = eustrndup(prop_name.u, str_key_len);
                                } else {
-                                       str_key_len = strlen(prop_name);
-                                       str_key = estrndup(prop_name, str_key_len);
+                                       str_key_len = strlen(prop_name.s);
+                                       str_key.s = estrndup(prop_name.s, str_key_len);
                                }
                                str_key_len++;
                        }
@@ -3289,12 +3289,12 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
 
                switch (key_type) {
                        case HASH_KEY_IS_STRING:
-                               Z_STRVAL_P(key) = str_key;
+                               Z_STRVAL_P(key) = str_key.s;
                                Z_STRLEN_P(key) = str_key_len-1;
                                Z_TYPE_P(key) = IS_STRING;
                                break;
                        case HASH_KEY_IS_UNICODE:
-                               Z_USTRVAL_P(key) = (UChar*)str_key;
+                               Z_USTRVAL_P(key) = str_key.u;
                                Z_USTRLEN_P(key) = str_key_len-1;
                                Z_TYPE_P(key) = IS_UNICODE;
                                break;
@@ -3400,20 +3400,19 @@ ZEND_VM_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, VAR|UNUSED|CV, CONST|
                                        break;
                                case IS_STRING:
                                case IS_UNICODE: {
-                                       char *offset_key = Z_UNIVAL_P(offset);
-                                       int   offset_len = Z_UNILEN_P(offset);
-                                       int   free_offset = 0;
+                                       zstr offset_key = Z_UNIVAL_P(offset);
+                                       int  offset_len = Z_UNILEN_P(offset);
+                                       int  free_offset = 0;
 
                                        if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) {
                                                /* Identifier normalization */
                                                UChar *norm;
-                                               int32_t norm_len;
+                                               int norm_len;
 
-                                               if (!zend_normalize_identifier(&norm, &norm_len,
-                                                                              (UChar*)offset_key, offset_len, 0)) {
+                                               if (!zend_normalize_identifier(&norm, &norm_len, offset_key.u, offset_len, 0)) {
                                                        zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key);
-                                               } else if ((char*)norm != offset_key) {
-                                                       offset_key = (char*)norm;
+                                               } else if (norm != offset_key.u) {
+                                                       offset_key.u = norm;
                                                        offset_len = norm_len;
                                                        free_offset = 1;
                                                }
@@ -3422,7 +3421,7 @@ ZEND_VM_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, VAR|UNUSED|CV, CONST|
                                                isset = 1;
                                        }
                                        if (free_offset) {
-                                               efree(offset_key);
+                                               efree(offset_key.v);
                                        }
                                        break;
                                }
@@ -3799,7 +3798,7 @@ ZEND_VM_HANDLER(151, ZEND_U_NORMALIZE, CONST|TMP|VAR|CV, ANY)
                zval var_copy;
                int use_copy;
                UChar *norm;
-               int32_t norm_len;
+               int norm_len;
 
                zend_make_unicode_zval(result, &var_copy, &use_copy);
                if (use_copy) {
index 467848804101e5742bd88ff550ee930b14d613a5..961d26bf701ce3cfa4f3e0abb1726e15c9651f0d 100644 (file)
@@ -146,8 +146,8 @@ static int zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
                        ZEND_VM_NEXT_OPCODE(); /* Never reached */
                }
                if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) {
-                       zend_error(E_NOTICE, "Function %s%s%s() is deprecated",
-                               EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : "",
+                       zend_error(E_NOTICE, "Function %v%s%v() is deprecated",
+                               EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : (zstr)EMPTY_STR,
                                EX(function_state).function->common.scope ? "::" : "",
                                EX(function_state).function->common.function_name);
                }
@@ -277,7 +277,7 @@ static int zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
                }
 
                if (EX(function_state).function->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) {
-                       efree(EX(function_state).function->common.function_name);
+                       efree(EX(function_state).function->common.function_name.v);
                }
                efree(EX(fbc));
 
@@ -367,7 +367,7 @@ static int ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 
        if (zend_ptr_stack_get_arg(arg_num, (void **) &param TSRMLS_CC)==FAILURE) {
                char *space;
-               char *class_name = get_active_class_name(&space TSRMLS_CC);
+               zstr class_name = get_active_class_name(&space TSRMLS_CC);
                zend_execute_data *ptr = EX(prev_execute_data);
 
                zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL TSRMLS_CC);
@@ -654,7 +654,7 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
 
        ce = EX_T(opline->op1.u.var).class_entry;
        if(IS_CONST != IS_UNUSED) {
-               char *function_name_strval;
+               zstr function_name_strval;
                unsigned int function_name_strlen;
                zend_bool is_const = (IS_CONST == IS_CONST);
 
@@ -674,7 +674,7 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
                EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
 
                if (!is_const) {
-                       efree(function_name_strval);
+                       efree(function_name_strval.v);
 
                }
        } else {
@@ -700,7 +700,7 @@ static int ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
        zend_op *opline = EX(opline);
        zval *function_name;
        zend_function *function;
-       void *function_name_strval, *lcname;
+       zstr function_name_strval, lcname;
        unsigned int function_name_strlen, lcname_len;
 
 
@@ -718,13 +718,13 @@ static int ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
        function_name_strval = Z_UNIVAL_P(function_name);
        function_name_strlen = Z_UNILEN_P(function_name);
 
-       lcname = zend_u_str_case_fold(Z_TYPE_P(function_name), Z_STRVAL_P(function_name), function_name_strlen, 1, &lcname_len);
+       lcname = zend_u_str_case_fold(Z_TYPE_P(function_name), Z_UNIVAL_P(function_name), function_name_strlen, 1, &lcname_len);
        if (zend_u_hash_find(EG(function_table), Z_TYPE_P(function_name), lcname, lcname_len+1, (void **) &function)==FAILURE) {
-               efree(lcname);
+               efree(lcname.v);
                zend_error_noreturn(E_ERROR, "Call to undefined function %R()", Z_TYPE_P(function_name), function_name_strval);
        }
 
-       efree(lcname);
+       efree(lcname.v);
        if (IS_CONST != IS_CONST) {
 
        }
@@ -841,7 +841,7 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
 
        ce = EX_T(opline->op1.u.var).class_entry;
        if(IS_TMP_VAR != IS_UNUSED) {
-               char *function_name_strval;
+               zstr function_name_strval;
                unsigned int function_name_strlen;
                zend_bool is_const = (IS_TMP_VAR == IS_CONST);
                zend_free_op free_op2;
@@ -861,7 +861,7 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
                EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
 
                if (!is_const) {
-                       efree(function_name_strval);
+                       efree(function_name_strval.v);
                        zval_dtor(free_op2.var);
                }
        } else {
@@ -887,7 +887,7 @@ static int ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
        zend_op *opline = EX(opline);
        zval *function_name;
        zend_function *function;
-       void *function_name_strval, *lcname;
+       zstr function_name_strval, lcname;
        unsigned int function_name_strlen, lcname_len;
        zend_free_op free_op2;
 
@@ -905,13 +905,13 @@ static int ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
        function_name_strval = Z_UNIVAL_P(function_name);
        function_name_strlen = Z_UNILEN_P(function_name);
 
-       lcname = zend_u_str_case_fold(Z_TYPE_P(function_name), Z_STRVAL_P(function_name), function_name_strlen, 1, &lcname_len);
+       lcname = zend_u_str_case_fold(Z_TYPE_P(function_name), Z_UNIVAL_P(function_name), function_name_strlen, 1, &lcname_len);
        if (zend_u_hash_find(EG(function_table), Z_TYPE_P(function_name), lcname, lcname_len+1, (void **) &function)==FAILURE) {
-               efree(lcname);
+               efree(lcname.v);
                zend_error_noreturn(E_ERROR, "Call to undefined function %R()", Z_TYPE_P(function_name), function_name_strval);
        }
 
-       efree(lcname);
+       efree(lcname.v);
        if (IS_TMP_VAR != IS_CONST) {
                zval_dtor(free_op2.var);
        }
@@ -965,7 +965,7 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
 
        ce = EX_T(opline->op1.u.var).class_entry;
        if(IS_VAR != IS_UNUSED) {
-               char *function_name_strval;
+               zstr function_name_strval;
                unsigned int function_name_strlen;
                zend_bool is_const = (IS_VAR == IS_CONST);
                zend_free_op free_op2;
@@ -985,7 +985,7 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
                EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
 
                if (!is_const) {
-                       efree(function_name_strval);
+                       efree(function_name_strval.v);
                        if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
                }
        } else {
@@ -1011,7 +1011,7 @@ static int ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
        zend_op *opline = EX(opline);
        zval *function_name;
        zend_function *function;
-       void *function_name_strval, *lcname;
+       zstr function_name_strval, lcname;
        unsigned int function_name_strlen, lcname_len;
        zend_free_op free_op2;
 
@@ -1029,13 +1029,13 @@ static int ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
        function_name_strval = Z_UNIVAL_P(function_name);
        function_name_strlen = Z_UNILEN_P(function_name);
 
-       lcname = zend_u_str_case_fold(Z_TYPE_P(function_name), Z_STRVAL_P(function_name), function_name_strlen, 1, &lcname_len);
+       lcname = zend_u_str_case_fold(Z_TYPE_P(function_name), Z_UNIVAL_P(function_name), function_name_strlen, 1, &lcname_len);
        if (zend_u_hash_find(EG(function_table), Z_TYPE_P(function_name), lcname, lcname_len+1, (void **) &function)==FAILURE) {
-               efree(lcname);
+               efree(lcname.v);
                zend_error_noreturn(E_ERROR, "Call to undefined function %R()", Z_TYPE_P(function_name), function_name_strval);
        }
 
-       efree(lcname);
+       efree(lcname.v);
        if (IS_VAR != IS_CONST) {
                if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
        }
@@ -1088,7 +1088,7 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_
 
        ce = EX_T(opline->op1.u.var).class_entry;
        if(IS_UNUSED != IS_UNUSED) {
-               char *function_name_strval;
+               zstr function_name_strval;
                unsigned int function_name_strlen;
                zend_bool is_const = (IS_UNUSED == IS_CONST);
 
@@ -1108,7 +1108,7 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_
                EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
 
                if (!is_const) {
-                       efree(function_name_strval);
+                       efree(function_name_strval.v);
 
                }
        } else {
@@ -1169,7 +1169,7 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
 
        ce = EX_T(opline->op1.u.var).class_entry;
        if(IS_CV != IS_UNUSED) {
-               char *function_name_strval;
+               zstr function_name_strval;
                unsigned int function_name_strlen;
                zend_bool is_const = (IS_CV == IS_CONST);
 
@@ -1189,7 +1189,7 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
                EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
 
                if (!is_const) {
-                       efree(function_name_strval);
+                       efree(function_name_strval.v);
 
                }
        } else {
@@ -1215,7 +1215,7 @@ static int ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
        zend_op *opline = EX(opline);
        zval *function_name;
        zend_function *function;
-       void *function_name_strval, *lcname;
+       zstr function_name_strval, lcname;
        unsigned int function_name_strlen, lcname_len;
 
 
@@ -1233,13 +1233,13 @@ static int ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
        function_name_strval = Z_UNIVAL_P(function_name);
        function_name_strlen = Z_UNILEN_P(function_name);
 
-       lcname = zend_u_str_case_fold(Z_TYPE_P(function_name), Z_STRVAL_P(function_name), function_name_strlen, 1, &lcname_len);
+       lcname = zend_u_str_case_fold(Z_TYPE_P(function_name), Z_UNIVAL_P(function_name), function_name_strlen, 1, &lcname_len);
        if (zend_u_hash_find(EG(function_table), Z_TYPE_P(function_name), lcname, lcname_len+1, (void **) &function)==FAILURE) {
-               efree(lcname);
+               efree(lcname.v);
                zend_error_noreturn(E_ERROR, "Call to undefined function %R()", Z_TYPE_P(function_name), function_name_strval);
        }
 
-       efree(lcname);
+       efree(lcname.v);
        if (IS_CV != IS_CONST) {
 
        }
@@ -1587,7 +1587,7 @@ return_by_value:
 
                if (EG(ze1_compatibility_mode) && Z_TYPE_P(retval_ptr) == IS_OBJECT) {
                        zval *ret;
-                       char *class_name;
+                       zstr class_name;
                        zend_uint class_name_len;
                        int dup;
 
@@ -1595,13 +1595,13 @@ return_by_value:
                        INIT_PZVAL_COPY(ret, retval_ptr);
                        dup = zend_get_object_classname(retval_ptr, &class_name, &class_name_len TSRMLS_CC);
                        if (Z_OBJ_HT_P(retval_ptr)->clone_obj == NULL) {
-                               zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v",  Z_OBJCE_P(retval_ptr)->name);
+                               zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v",  class_name);
                        }
-                       zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", Z_OBJCE_P(retval_ptr)->name);
+                       zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name);
                        Z_OBJVAL_P(ret) = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC);
                        *EG(return_value_ptr_ptr) = ret;
                        if (!dup) {
-                               efree(class_name);
+                               efree(class_name.v);
                        }
                } else if (!0) { /* Not a temp var */
                        if (EG(active_op_array)->return_reference == ZEND_RETURN_REF ||
@@ -1720,13 +1720,13 @@ static int ZEND_CLONE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                        /* Ensure that if we're calling a private function, we're allowed to do so.
                         */
                        if (ce != EG(scope)) {
-                               zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR);
+                               zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR);
                        }
                } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
                        /* Ensure that if we're calling a protected function, we're allowed to do so.
                         */
                        if (!zend_check_protected(clone->common.scope, EG(scope))) {
-                               zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR);
+                               zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR);
                        }
                }
        }
@@ -1959,7 +1959,7 @@ static int ZEND_UNSET_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                        for (i = 0; i < ex->op_array->last_var; i++) {
                                                if (ex->op_array->vars[i].hash_value == hash_value &&
                                                    ex->op_array->vars[i].name_len == Z_UNILEN_P(varname) &&
-                                                   !memcmp(ex->op_array->vars[i].name, Z_UNIVAL_P(varname), Z_TYPE_P(varname)==IS_UNICODE?UBYTES(Z_UNILEN_P(varname)):Z_UNILEN_P(varname))) {
+                                                   !memcmp(ex->op_array->vars[i].name.v, Z_UNIVAL_P(varname).v, Z_TYPE_P(varname)==IS_UNICODE?UBYTES(Z_UNILEN_P(varname)):Z_UNILEN_P(varname))) {
                                                        ex->CVs[i] = NULL;
                                                        break;
                                                }
@@ -2070,7 +2070,7 @@ static int ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                if (ce) {
                        zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC);
                        while (zend_hash_has_more_elements(fe_ht) == SUCCESS) {
-                               char *str_key;
+                               zstr str_key;
                                uint str_key_len;
                                ulong int_key;
                                zend_uchar key_type;
@@ -2216,7 +2216,7 @@ static int ZEND_U_NORMALIZE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                zval var_copy;
                int use_copy;
                UChar *norm;
-               int32_t norm_len;
+               int norm_len;
 
                zend_make_unicode_zval(result, &var_copy, &use_copy);
                if (use_copy) {
@@ -4080,7 +4080,7 @@ return_by_value:
 
                if (EG(ze1_compatibility_mode) && Z_TYPE_P(retval_ptr) == IS_OBJECT) {
                        zval *ret;
-                       char *class_name;
+                       zstr class_name;
                        zend_uint class_name_len;
                        int dup;
 
@@ -4088,13 +4088,13 @@ return_by_value:
                        INIT_PZVAL_COPY(ret, retval_ptr);
                        dup = zend_get_object_classname(retval_ptr, &class_name, &class_name_len TSRMLS_CC);
                        if (Z_OBJ_HT_P(retval_ptr)->clone_obj == NULL) {
-                               zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v",  Z_OBJCE_P(retval_ptr)->name);
+                               zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v",  class_name);
                        }
-                       zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", Z_OBJCE_P(retval_ptr)->name);
+                       zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name);
                        Z_OBJVAL_P(ret) = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC);
                        *EG(return_value_ptr_ptr) = ret;
                        if (!dup) {
-                               efree(class_name);
+                               efree(class_name.v);
                        }
                } else if (!1) { /* Not a temp var */
                        if (EG(active_op_array)->return_reference == ZEND_RETURN_REF ||
@@ -4220,13 +4220,13 @@ static int ZEND_CLONE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                        /* Ensure that if we're calling a private function, we're allowed to do so.
                         */
                        if (ce != EG(scope)) {
-                               zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR);
+                               zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR);
                        }
                } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
                        /* Ensure that if we're calling a protected function, we're allowed to do so.
                         */
                        if (!zend_check_protected(clone->common.scope, EG(scope))) {
-                               zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR);
+                               zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR);
                        }
                }
        }
@@ -4459,7 +4459,7 @@ static int ZEND_UNSET_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                        for (i = 0; i < ex->op_array->last_var; i++) {
                                                if (ex->op_array->vars[i].hash_value == hash_value &&
                                                    ex->op_array->vars[i].name_len == Z_UNILEN_P(varname) &&
-                                                   !memcmp(ex->op_array->vars[i].name, Z_UNIVAL_P(varname), Z_TYPE_P(varname)==IS_UNICODE?UBYTES(Z_UNILEN_P(varname)):Z_UNILEN_P(varname))) {
+                                                   !memcmp(ex->op_array->vars[i].name.v, Z_UNIVAL_P(varname).v, Z_TYPE_P(varname)==IS_UNICODE?UBYTES(Z_UNILEN_P(varname)):Z_UNILEN_P(varname))) {
                                                        ex->CVs[i] = NULL;
                                                        break;
                                                }
@@ -4570,7 +4570,7 @@ static int ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                if (ce) {
                        zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC);
                        while (zend_hash_has_more_elements(fe_ht) == SUCCESS) {
-                               char *str_key;
+                               zstr str_key;
                                uint str_key_len;
                                ulong int_key;
                                zend_uchar key_type;
@@ -4739,7 +4739,7 @@ static int ZEND_U_NORMALIZE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                zval var_copy;
                int use_copy;
                UChar *norm;
-               int32_t norm_len;
+               int norm_len;
 
                zend_make_unicode_zval(result, &var_copy, &use_copy);
                if (use_copy) {
@@ -5043,7 +5043,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS
 {
        zend_op *opline = EX(opline);
        zval *function_name;
-       char *function_name_strval;
+       zstr function_name_strval;
        int function_name_strlen;
        zend_free_op free_op1;
        /* FIXME: type is default */
@@ -5477,7 +5477,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 {
        zend_op *opline = EX(opline);
        zval *function_name;
-       char *function_name_strval;
+       zstr function_name_strval;
        int function_name_strlen;
        zend_free_op free_op1, free_op2;
        /* FIXME: type is default */
@@ -5913,7 +5913,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 {
        zend_op *opline = EX(opline);
        zval *function_name;
-       char *function_name_strval;
+       zstr function_name_strval;
        int function_name_strlen;
        zend_free_op free_op1, free_op2;
        /* FIXME: type is default */
@@ -6430,7 +6430,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 {
        zend_op *opline = EX(opline);
        zval *function_name;
-       char *function_name_strval;
+       zstr function_name_strval;
        int function_name_strlen;
        zend_free_op free_op1;
        /* FIXME: type is default */
@@ -7080,7 +7080,7 @@ return_by_value:
 
                if (EG(ze1_compatibility_mode) && Z_TYPE_P(retval_ptr) == IS_OBJECT) {
                        zval *ret;
-                       char *class_name;
+                       zstr class_name;
                        zend_uint class_name_len;
                        int dup;
 
@@ -7088,13 +7088,13 @@ return_by_value:
                        INIT_PZVAL_COPY(ret, retval_ptr);
                        dup = zend_get_object_classname(retval_ptr, &class_name, &class_name_len TSRMLS_CC);
                        if (Z_OBJ_HT_P(retval_ptr)->clone_obj == NULL) {
-                               zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v",  Z_OBJCE_P(retval_ptr)->name);
+                               zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v",  class_name);
                        }
-                       zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", Z_OBJCE_P(retval_ptr)->name);
+                       zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name);
                        Z_OBJVAL_P(ret) = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC);
                        *EG(return_value_ptr_ptr) = ret;
                        if (!dup) {
-                               efree(class_name);
+                               efree(class_name.v);
                        }
                } else if (!0) { /* Not a temp var */
                        if (EG(active_op_array)->return_reference == ZEND_RETURN_REF ||
@@ -7317,13 +7317,13 @@ static int ZEND_CLONE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                        /* Ensure that if we're calling a private function, we're allowed to do so.
                         */
                        if (ce != EG(scope)) {
-                               zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR);
+                               zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR);
                        }
                } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
                        /* Ensure that if we're calling a protected function, we're allowed to do so.
                         */
                        if (!zend_check_protected(clone->common.scope, EG(scope))) {
-                               zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR);
+                               zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR);
                        }
                }
        }
@@ -7556,7 +7556,7 @@ static int ZEND_UNSET_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                        for (i = 0; i < ex->op_array->last_var; i++) {
                                                if (ex->op_array->vars[i].hash_value == hash_value &&
                                                    ex->op_array->vars[i].name_len == Z_UNILEN_P(varname) &&
-                                                   !memcmp(ex->op_array->vars[i].name, Z_UNIVAL_P(varname), Z_TYPE_P(varname)==IS_UNICODE?UBYTES(Z_UNILEN_P(varname)):Z_UNILEN_P(varname))) {
+                                                   !memcmp(ex->op_array->vars[i].name.v, Z_UNIVAL_P(varname).v, Z_TYPE_P(varname)==IS_UNICODE?UBYTES(Z_UNILEN_P(varname)):Z_UNILEN_P(varname))) {
                                                        ex->CVs[i] = NULL;
                                                        break;
                                                }
@@ -7667,7 +7667,7 @@ static int ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                if (ce) {
                        zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC);
                        while (zend_hash_has_more_elements(fe_ht) == SUCCESS) {
-                               char *str_key;
+                               zstr str_key;
                                uint str_key_len;
                                ulong int_key;
                                zend_uchar key_type;
@@ -7704,7 +7704,7 @@ static int ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
        zend_free_op free_op1;
        zval *array = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC);
        zval **value;
-       char *str_key;
+       zstr str_key;
        uint str_key_len;
        ulong int_key;
        HashTable *fe_ht;
@@ -7721,7 +7721,7 @@ static int ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                        ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.u.opline_num);
 
                case ZEND_ITER_PLAIN_OBJECT: {
-                       char *class_name, *prop_name;
+                       zstr class_name, prop_name;
                        zend_object *zobj = zend_objects_get_address(array TSRMLS_CC);
 
                        fe_ht = HASH_OF(array);
@@ -7737,11 +7737,11 @@ static int ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                        if (use_key) {
                                zend_u_unmangle_property_name(key_type == HASH_KEY_IS_UNICODE?IS_UNICODE:IS_STRING, str_key, &class_name, &prop_name);
                                if (key_type == HASH_KEY_IS_UNICODE) {
-                                       str_key_len = u_strlen((UChar*)prop_name);
-                                       str_key = (char*)eustrndup((UChar*)prop_name, str_key_len);
+                                       str_key_len = u_strlen(prop_name.u);
+                                       str_key.u = eustrndup(prop_name.u, str_key_len);
                                } else {
-                                       str_key_len = strlen(prop_name);
-                                       str_key = estrndup(prop_name, str_key_len);
+                                       str_key_len = strlen(prop_name.s);
+                                       str_key.s = estrndup(prop_name.s, str_key_len);
                                }
                                str_key_len++;
                        }
@@ -7825,12 +7825,12 @@ static int ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 
                switch (key_type) {
                        case HASH_KEY_IS_STRING:
-                               Z_STRVAL_P(key) = str_key;
+                               Z_STRVAL_P(key) = str_key.s;
                                Z_STRLEN_P(key) = str_key_len-1;
                                Z_TYPE_P(key) = IS_STRING;
                                break;
                        case HASH_KEY_IS_UNICODE:
-                               Z_USTRVAL_P(key) = (UChar*)str_key;
+                               Z_USTRVAL_P(key) = str_key.u;
                                Z_USTRLEN_P(key) = str_key_len-1;
                                Z_TYPE_P(key) = IS_UNICODE;
                                break;
@@ -7966,7 +7966,7 @@ static int ZEND_U_NORMALIZE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                zval var_copy;
                int use_copy;
                UChar *norm;
-               int32_t norm_len;
+               int norm_len;
 
                zend_make_unicode_zval(result, &var_copy, &use_copy);
                if (use_copy) {
@@ -8989,7 +8989,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS
 {
        zend_op *opline = EX(opline);
        zval *function_name;
-       char *function_name_strval;
+       zstr function_name_strval;
        int function_name_strlen;
        zend_free_op free_op1;
        /* FIXME: type is default */
@@ -9185,20 +9185,20 @@ static int ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                break;
                                        case IS_STRING:
                                        case IS_UNICODE: {
-                                               void *offset_key = Z_UNIVAL_P(offset);
+                                               zstr offset_key = Z_UNIVAL_P(offset);
                                                int  offset_len  = Z_UNILEN_P(offset);
                                                int free_offset = 0;
 
                                                if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) {
                                                        /* Identifier normalization */
                                                        UChar *norm;
-                                                       int32_t norm_len;
+                                                       int norm_len;
 
                                                        if (!zend_normalize_identifier(&norm, &norm_len,
-                                                                                      (UChar*)offset_key, offset_len, 0)) {
-                                                               zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key);
-                                                       } else if ((char*)norm != offset_key) {
-                                                               offset_key = (char*)norm;
+                                                                                      offset_key.u, offset_len, 0)) {
+                                                               zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key.u);
+                                                       } else if (norm != offset_key.u) {
+                                                               offset_key.u = norm;
                                                                offset_len = norm_len;
                                                                free_offset = 1;
                                                        }
@@ -9216,7 +9216,7 @@ static int ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                                        for (i = 0; i < ex->op_array->last_var; i++) {
                                                                                if (ex->op_array->vars[i].hash_value == hash_value &&
                                                                                    ex->op_array->vars[i].name_len == offset_len &&
-                                                                                   !memcmp(ex->op_array->vars[i].name, offset_key, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) {
+                                                                                   !memcmp(ex->op_array->vars[i].name.v, offset_key.v, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) {
                                                                                        ex->CVs[i] = NULL;
                                                                                        break;
                                                                                }
@@ -9225,7 +9225,7 @@ static int ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                        }
                                                }
                                                if (free_offset) {
-                                                       efree(offset_key);
+                                                       efree(offset_key.v);
                                                }
                                                break;
                                        }
@@ -9336,20 +9336,19 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST(int prop_dim,
                                        break;
                                case IS_STRING:
                                case IS_UNICODE: {
-                                       char *offset_key = Z_UNIVAL_P(offset);
-                                       int   offset_len = Z_UNILEN_P(offset);
-                                       int   free_offset = 0;
+                                       zstr offset_key = Z_UNIVAL_P(offset);
+                                       int  offset_len = Z_UNILEN_P(offset);
+                                       int  free_offset = 0;
 
                                        if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) {
                                                /* Identifier normalization */
                                                UChar *norm;
-                                               int32_t norm_len;
+                                               int norm_len;
 
-                                               if (!zend_normalize_identifier(&norm, &norm_len,
-                                                                              (UChar*)offset_key, offset_len, 0)) {
+                                               if (!zend_normalize_identifier(&norm, &norm_len, offset_key.u, offset_len, 0)) {
                                                        zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key);
-                                               } else if ((char*)norm != offset_key) {
-                                                       offset_key = (char*)norm;
+                                               } else if (norm != offset_key.u) {
+                                                       offset_key.u = norm;
                                                        offset_len = norm_len;
                                                        free_offset = 1;
                                                }
@@ -9358,7 +9357,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST(int prop_dim,
                                                isset = 1;
                                        }
                                        if (free_offset) {
-                                               efree(offset_key);
+                                               efree(offset_key.v);
                                        }
                                        break;
                                }
@@ -10471,7 +10470,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 {
        zend_op *opline = EX(opline);
        zval *function_name;
-       char *function_name_strval;
+       zstr function_name_strval;
        int function_name_strlen;
        zend_free_op free_op1, free_op2;
        /* FIXME: type is default */
@@ -10669,20 +10668,20 @@ static int ZEND_UNSET_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                break;
                                        case IS_STRING:
                                        case IS_UNICODE: {
-                                               void *offset_key = Z_UNIVAL_P(offset);
+                                               zstr offset_key = Z_UNIVAL_P(offset);
                                                int  offset_len  = Z_UNILEN_P(offset);
                                                int free_offset = 0;
 
                                                if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) {
                                                        /* Identifier normalization */
                                                        UChar *norm;
-                                                       int32_t norm_len;
+                                                       int norm_len;
 
                                                        if (!zend_normalize_identifier(&norm, &norm_len,
-                                                                                      (UChar*)offset_key, offset_len, 0)) {
-                                                               zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key);
-                                                       } else if ((char*)norm != offset_key) {
-                                                               offset_key = (char*)norm;
+                                                                                      offset_key.u, offset_len, 0)) {
+                                                               zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key.u);
+                                                       } else if (norm != offset_key.u) {
+                                                               offset_key.u = norm;
                                                                offset_len = norm_len;
                                                                free_offset = 1;
                                                        }
@@ -10700,7 +10699,7 @@ static int ZEND_UNSET_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                                        for (i = 0; i < ex->op_array->last_var; i++) {
                                                                                if (ex->op_array->vars[i].hash_value == hash_value &&
                                                                                    ex->op_array->vars[i].name_len == offset_len &&
-                                                                                   !memcmp(ex->op_array->vars[i].name, offset_key, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) {
+                                                                                   !memcmp(ex->op_array->vars[i].name.v, offset_key.v, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) {
                                                                                        ex->CVs[i] = NULL;
                                                                                        break;
                                                                                }
@@ -10709,7 +10708,7 @@ static int ZEND_UNSET_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                        }
                                                }
                                                if (free_offset) {
-                                                       efree(offset_key);
+                                                       efree(offset_key.v);
                                                }
                                                break;
                                        }
@@ -10820,20 +10819,19 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(int prop_dim, ZE
                                        break;
                                case IS_STRING:
                                case IS_UNICODE: {
-                                       char *offset_key = Z_UNIVAL_P(offset);
-                                       int   offset_len = Z_UNILEN_P(offset);
-                                       int   free_offset = 0;
+                                       zstr offset_key = Z_UNIVAL_P(offset);
+                                       int  offset_len = Z_UNILEN_P(offset);
+                                       int  free_offset = 0;
 
                                        if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) {
                                                /* Identifier normalization */
                                                UChar *norm;
-                                               int32_t norm_len;
+                                               int norm_len;
 
-                                               if (!zend_normalize_identifier(&norm, &norm_len,
-                                                                              (UChar*)offset_key, offset_len, 0)) {
+                                               if (!zend_normalize_identifier(&norm, &norm_len, offset_key.u, offset_len, 0)) {
                                                        zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key);
-                                               } else if ((char*)norm != offset_key) {
-                                                       offset_key = (char*)norm;
+                                               } else if (norm != offset_key.u) {
+                                                       offset_key.u = norm;
                                                        offset_len = norm_len;
                                                        free_offset = 1;
                                                }
@@ -10842,7 +10840,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(int prop_dim, ZE
                                                isset = 1;
                                        }
                                        if (free_offset) {
-                                               efree(offset_key);
+                                               efree(offset_key.v);
                                        }
                                        break;
                                }
@@ -11993,7 +11991,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 {
        zend_op *opline = EX(opline);
        zval *function_name;
-       char *function_name_strval;
+       zstr function_name_strval;
        int function_name_strlen;
        zend_free_op free_op1, free_op2;
        /* FIXME: type is default */
@@ -12191,20 +12189,20 @@ static int ZEND_UNSET_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                break;
                                        case IS_STRING:
                                        case IS_UNICODE: {
-                                               void *offset_key = Z_UNIVAL_P(offset);
+                                               zstr offset_key = Z_UNIVAL_P(offset);
                                                int  offset_len  = Z_UNILEN_P(offset);
                                                int free_offset = 0;
 
                                                if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) {
                                                        /* Identifier normalization */
                                                        UChar *norm;
-                                                       int32_t norm_len;
+                                                       int norm_len;
 
                                                        if (!zend_normalize_identifier(&norm, &norm_len,
-                                                                                      (UChar*)offset_key, offset_len, 0)) {
-                                                               zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key);
-                                                       } else if ((char*)norm != offset_key) {
-                                                               offset_key = (char*)norm;
+                                                                                      offset_key.u, offset_len, 0)) {
+                                                               zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key.u);
+                                                       } else if (norm != offset_key.u) {
+                                                               offset_key.u = norm;
                                                                offset_len = norm_len;
                                                                free_offset = 1;
                                                        }
@@ -12222,7 +12220,7 @@ static int ZEND_UNSET_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                                        for (i = 0; i < ex->op_array->last_var; i++) {
                                                                                if (ex->op_array->vars[i].hash_value == hash_value &&
                                                                                    ex->op_array->vars[i].name_len == offset_len &&
-                                                                                   !memcmp(ex->op_array->vars[i].name, offset_key, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) {
+                                                                                   !memcmp(ex->op_array->vars[i].name.v, offset_key.v, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) {
                                                                                        ex->CVs[i] = NULL;
                                                                                        break;
                                                                                }
@@ -12231,7 +12229,7 @@ static int ZEND_UNSET_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                        }
                                                }
                                                if (free_offset) {
-                                                       efree(offset_key);
+                                                       efree(offset_key.v);
                                                }
                                                break;
                                        }
@@ -12342,20 +12340,19 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(int prop_dim, ZE
                                        break;
                                case IS_STRING:
                                case IS_UNICODE: {
-                                       char *offset_key = Z_UNIVAL_P(offset);
-                                       int   offset_len = Z_UNILEN_P(offset);
-                                       int   free_offset = 0;
+                                       zstr offset_key = Z_UNIVAL_P(offset);
+                                       int  offset_len = Z_UNILEN_P(offset);
+                                       int  free_offset = 0;
 
                                        if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) {
                                                /* Identifier normalization */
                                                UChar *norm;
-                                               int32_t norm_len;
+                                               int norm_len;
 
-                                               if (!zend_normalize_identifier(&norm, &norm_len,
-                                                                              (UChar*)offset_key, offset_len, 0)) {
+                                               if (!zend_normalize_identifier(&norm, &norm_len, offset_key.u, offset_len, 0)) {
                                                        zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key);
-                                               } else if ((char*)norm != offset_key) {
-                                                       offset_key = (char*)norm;
+                                               } else if (norm != offset_key.u) {
+                                                       offset_key.u = norm;
                                                        offset_len = norm_len;
                                                        free_offset = 1;
                                                }
@@ -12364,7 +12361,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(int prop_dim, ZE
                                                isset = 1;
                                        }
                                        if (free_offset) {
-                                               efree(offset_key);
+                                               efree(offset_key.v);
                                        }
                                        break;
                                }
@@ -13920,7 +13917,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 {
        zend_op *opline = EX(opline);
        zval *function_name;
-       char *function_name_strval;
+       zstr function_name_strval;
        int function_name_strlen;
        zend_free_op free_op1;
        /* FIXME: type is default */
@@ -14116,20 +14113,20 @@ static int ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                break;
                                        case IS_STRING:
                                        case IS_UNICODE: {
-                                               void *offset_key = Z_UNIVAL_P(offset);
+                                               zstr offset_key = Z_UNIVAL_P(offset);
                                                int  offset_len  = Z_UNILEN_P(offset);
                                                int free_offset = 0;
 
                                                if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) {
                                                        /* Identifier normalization */
                                                        UChar *norm;
-                                                       int32_t norm_len;
+                                                       int norm_len;
 
                                                        if (!zend_normalize_identifier(&norm, &norm_len,
-                                                                                      (UChar*)offset_key, offset_len, 0)) {
-                                                               zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key);
-                                                       } else if ((char*)norm != offset_key) {
-                                                               offset_key = (char*)norm;
+                                                                                      offset_key.u, offset_len, 0)) {
+                                                               zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key.u);
+                                                       } else if (norm != offset_key.u) {
+                                                               offset_key.u = norm;
                                                                offset_len = norm_len;
                                                                free_offset = 1;
                                                        }
@@ -14147,7 +14144,7 @@ static int ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                                        for (i = 0; i < ex->op_array->last_var; i++) {
                                                                                if (ex->op_array->vars[i].hash_value == hash_value &&
                                                                                    ex->op_array->vars[i].name_len == offset_len &&
-                                                                                   !memcmp(ex->op_array->vars[i].name, offset_key, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) {
+                                                                                   !memcmp(ex->op_array->vars[i].name.v, offset_key.v, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) {
                                                                                        ex->CVs[i] = NULL;
                                                                                        break;
                                                                                }
@@ -14156,7 +14153,7 @@ static int ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                        }
                                                }
                                                if (free_offset) {
-                                                       efree(offset_key);
+                                                       efree(offset_key.v);
                                                }
                                                break;
                                        }
@@ -14267,20 +14264,19 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int prop_dim, ZEN
                                        break;
                                case IS_STRING:
                                case IS_UNICODE: {
-                                       char *offset_key = Z_UNIVAL_P(offset);
-                                       int   offset_len = Z_UNILEN_P(offset);
-                                       int   free_offset = 0;
+                                       zstr offset_key = Z_UNIVAL_P(offset);
+                                       int  offset_len = Z_UNILEN_P(offset);
+                                       int  free_offset = 0;
 
                                        if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) {
                                                /* Identifier normalization */
                                                UChar *norm;
-                                               int32_t norm_len;
+                                               int norm_len;
 
-                                               if (!zend_normalize_identifier(&norm, &norm_len,
-                                                                              (UChar*)offset_key, offset_len, 0)) {
+                                               if (!zend_normalize_identifier(&norm, &norm_len, offset_key.u, offset_len, 0)) {
                                                        zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key);
-                                               } else if ((char*)norm != offset_key) {
-                                                       offset_key = (char*)norm;
+                                               } else if (norm != offset_key.u) {
+                                                       offset_key.u = norm;
                                                        offset_len = norm_len;
                                                        free_offset = 1;
                                                }
@@ -14289,7 +14285,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int prop_dim, ZEN
                                                isset = 1;
                                        }
                                        if (free_offset) {
-                                               efree(offset_key);
+                                               efree(offset_key.v);
                                        }
                                        break;
                                }
@@ -14427,13 +14423,13 @@ static int ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                        /* Ensure that if we're calling a private function, we're allowed to do so.
                         */
                        if (ce != EG(scope)) {
-                               zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR);
+                               zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR);
                        }
                } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
                        /* Ensure that if we're calling a protected function, we're allowed to do so.
                         */
                        if (!zend_check_protected(clone->common.scope, EG(scope))) {
-                               zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR);
+                               zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR);
                        }
                }
        }
@@ -15122,7 +15118,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
 {
        zend_op *opline = EX(opline);
        zval *function_name;
-       char *function_name_strval;
+       zstr function_name_strval;
        int function_name_strlen;
 
        /* FIXME: type is default */
@@ -15329,20 +15325,20 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                break;
                                        case IS_STRING:
                                        case IS_UNICODE: {
-                                               void *offset_key = Z_UNIVAL_P(offset);
+                                               zstr offset_key = Z_UNIVAL_P(offset);
                                                int  offset_len  = Z_UNILEN_P(offset);
                                                int free_offset = 0;
 
                                                if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) {
                                                        /* Identifier normalization */
                                                        UChar *norm;
-                                                       int32_t norm_len;
+                                                       int norm_len;
 
                                                        if (!zend_normalize_identifier(&norm, &norm_len,
-                                                                                      (UChar*)offset_key, offset_len, 0)) {
-                                                               zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key);
-                                                       } else if ((char*)norm != offset_key) {
-                                                               offset_key = (char*)norm;
+                                                                                      offset_key.u, offset_len, 0)) {
+                                                               zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key.u);
+                                                       } else if (norm != offset_key.u) {
+                                                               offset_key.u = norm;
                                                                offset_len = norm_len;
                                                                free_offset = 1;
                                                        }
@@ -15360,7 +15356,7 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                                        for (i = 0; i < ex->op_array->last_var; i++) {
                                                                                if (ex->op_array->vars[i].hash_value == hash_value &&
                                                                                    ex->op_array->vars[i].name_len == offset_len &&
-                                                                                   !memcmp(ex->op_array->vars[i].name, offset_key, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) {
+                                                                                   !memcmp(ex->op_array->vars[i].name.v, offset_key.v, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) {
                                                                                        ex->CVs[i] = NULL;
                                                                                        break;
                                                                                }
@@ -15369,7 +15365,7 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                        }
                                                }
                                                if (free_offset) {
-                                                       efree(offset_key);
+                                                       efree(offset_key.v);
                                                }
                                                break;
                                        }
@@ -15478,20 +15474,19 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CONST(int prop_di
                                        break;
                                case IS_STRING:
                                case IS_UNICODE: {
-                                       char *offset_key = Z_UNIVAL_P(offset);
-                                       int   offset_len = Z_UNILEN_P(offset);
-                                       int   free_offset = 0;
+                                       zstr offset_key = Z_UNIVAL_P(offset);
+                                       int  offset_len = Z_UNILEN_P(offset);
+                                       int  free_offset = 0;
 
                                        if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) {
                                                /* Identifier normalization */
                                                UChar *norm;
-                                               int32_t norm_len;
+                                               int norm_len;
 
-                                               if (!zend_normalize_identifier(&norm, &norm_len,
-                                                                              (UChar*)offset_key, offset_len, 0)) {
+                                               if (!zend_normalize_identifier(&norm, &norm_len, offset_key.u, offset_len, 0)) {
                                                        zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key);
-                                               } else if ((char*)norm != offset_key) {
-                                                       offset_key = (char*)norm;
+                                               } else if (norm != offset_key.u) {
+                                                       offset_key.u = norm;
                                                        offset_len = norm_len;
                                                        free_offset = 1;
                                                }
@@ -15500,7 +15495,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CONST(int prop_di
                                                isset = 1;
                                        }
                                        if (free_offset) {
-                                               efree(offset_key);
+                                               efree(offset_key.v);
                                        }
                                        break;
                                }
@@ -16259,7 +16254,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
 {
        zend_op *opline = EX(opline);
        zval *function_name;
-       char *function_name_strval;
+       zstr function_name_strval;
        int function_name_strlen;
        zend_free_op free_op2;
        /* FIXME: type is default */
@@ -16424,20 +16419,20 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                break;
                                        case IS_STRING:
                                        case IS_UNICODE: {
-                                               void *offset_key = Z_UNIVAL_P(offset);
+                                               zstr offset_key = Z_UNIVAL_P(offset);
                                                int  offset_len  = Z_UNILEN_P(offset);
                                                int free_offset = 0;
 
                                                if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) {
                                                        /* Identifier normalization */
                                                        UChar *norm;
-                                                       int32_t norm_len;
+                                                       int norm_len;
 
                                                        if (!zend_normalize_identifier(&norm, &norm_len,
-                                                                                      (UChar*)offset_key, offset_len, 0)) {
-                                                               zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key);
-                                                       } else if ((char*)norm != offset_key) {
-                                                               offset_key = (char*)norm;
+                                                                                      offset_key.u, offset_len, 0)) {
+                                                               zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key.u);
+                                                       } else if (norm != offset_key.u) {
+                                                               offset_key.u = norm;
                                                                offset_len = norm_len;
                                                                free_offset = 1;
                                                        }
@@ -16455,7 +16450,7 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                                        for (i = 0; i < ex->op_array->last_var; i++) {
                                                                                if (ex->op_array->vars[i].hash_value == hash_value &&
                                                                                    ex->op_array->vars[i].name_len == offset_len &&
-                                                                                   !memcmp(ex->op_array->vars[i].name, offset_key, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) {
+                                                                                   !memcmp(ex->op_array->vars[i].name.v, offset_key.v, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) {
                                                                                        ex->CVs[i] = NULL;
                                                                                        break;
                                                                                }
@@ -16464,7 +16459,7 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                        }
                                                }
                                                if (free_offset) {
-                                                       efree(offset_key);
+                                                       efree(offset_key.v);
                                                }
                                                break;
                                        }
@@ -16573,20 +16568,19 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP(int prop_dim,
                                        break;
                                case IS_STRING:
                                case IS_UNICODE: {
-                                       char *offset_key = Z_UNIVAL_P(offset);
-                                       int   offset_len = Z_UNILEN_P(offset);
-                                       int   free_offset = 0;
+                                       zstr offset_key = Z_UNIVAL_P(offset);
+                                       int  offset_len = Z_UNILEN_P(offset);
+                                       int  free_offset = 0;
 
                                        if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) {
                                                /* Identifier normalization */
                                                UChar *norm;
-                                               int32_t norm_len;
+                                               int norm_len;
 
-                                               if (!zend_normalize_identifier(&norm, &norm_len,
-                                                                              (UChar*)offset_key, offset_len, 0)) {
+                                               if (!zend_normalize_identifier(&norm, &norm_len, offset_key.u, offset_len, 0)) {
                                                        zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key);
-                                               } else if ((char*)norm != offset_key) {
-                                                       offset_key = (char*)norm;
+                                               } else if (norm != offset_key.u) {
+                                                       offset_key.u = norm;
                                                        offset_len = norm_len;
                                                        free_offset = 1;
                                                }
@@ -16595,7 +16589,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP(int prop_dim,
                                                isset = 1;
                                        }
                                        if (free_offset) {
-                                               efree(offset_key);
+                                               efree(offset_key.v);
                                        }
                                        break;
                                }
@@ -17354,7 +17348,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
 {
        zend_op *opline = EX(opline);
        zval *function_name;
-       char *function_name_strval;
+       zstr function_name_strval;
        int function_name_strlen;
        zend_free_op free_op2;
        /* FIXME: type is default */
@@ -17519,20 +17513,20 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                break;
                                        case IS_STRING:
                                        case IS_UNICODE: {
-                                               void *offset_key = Z_UNIVAL_P(offset);
+                                               zstr offset_key = Z_UNIVAL_P(offset);
                                                int  offset_len  = Z_UNILEN_P(offset);
                                                int free_offset = 0;
 
                                                if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) {
                                                        /* Identifier normalization */
                                                        UChar *norm;
-                                                       int32_t norm_len;
+                                                       int norm_len;
 
                                                        if (!zend_normalize_identifier(&norm, &norm_len,
-                                                                                      (UChar*)offset_key, offset_len, 0)) {
-                                                               zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key);
-                                                       } else if ((char*)norm != offset_key) {
-                                                               offset_key = (char*)norm;
+                                                                                      offset_key.u, offset_len, 0)) {
+                                                               zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key.u);
+                                                       } else if (norm != offset_key.u) {
+                                                               offset_key.u = norm;
                                                                offset_len = norm_len;
                                                                free_offset = 1;
                                                        }
@@ -17550,7 +17544,7 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                                        for (i = 0; i < ex->op_array->last_var; i++) {
                                                                                if (ex->op_array->vars[i].hash_value == hash_value &&
                                                                                    ex->op_array->vars[i].name_len == offset_len &&
-                                                                                   !memcmp(ex->op_array->vars[i].name, offset_key, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) {
+                                                                                   !memcmp(ex->op_array->vars[i].name.v, offset_key.v, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) {
                                                                                        ex->CVs[i] = NULL;
                                                                                        break;
                                                                                }
@@ -17559,7 +17553,7 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                        }
                                                }
                                                if (free_offset) {
-                                                       efree(offset_key);
+                                                       efree(offset_key.v);
                                                }
                                                break;
                                        }
@@ -17668,20 +17662,19 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR(int prop_dim,
                                        break;
                                case IS_STRING:
                                case IS_UNICODE: {
-                                       char *offset_key = Z_UNIVAL_P(offset);
-                                       int   offset_len = Z_UNILEN_P(offset);
-                                       int   free_offset = 0;
+                                       zstr offset_key = Z_UNIVAL_P(offset);
+                                       int  offset_len = Z_UNILEN_P(offset);
+                                       int  free_offset = 0;
 
                                        if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) {
                                                /* Identifier normalization */
                                                UChar *norm;
-                                               int32_t norm_len;
+                                               int norm_len;
 
-                                               if (!zend_normalize_identifier(&norm, &norm_len,
-                                                                              (UChar*)offset_key, offset_len, 0)) {
+                                               if (!zend_normalize_identifier(&norm, &norm_len, offset_key.u, offset_len, 0)) {
                                                        zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key);
-                                               } else if ((char*)norm != offset_key) {
-                                                       offset_key = (char*)norm;
+                                               } else if (norm != offset_key.u) {
+                                                       offset_key.u = norm;
                                                        offset_len = norm_len;
                                                        free_offset = 1;
                                                }
@@ -17690,7 +17683,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR(int prop_dim,
                                                isset = 1;
                                        }
                                        if (free_offset) {
-                                               efree(offset_key);
+                                               efree(offset_key.v);
                                        }
                                        break;
                                }
@@ -18814,7 +18807,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
 {
        zend_op *opline = EX(opline);
        zval *function_name;
-       char *function_name_strval;
+       zstr function_name_strval;
        int function_name_strlen;
 
        /* FIXME: type is default */
@@ -18978,20 +18971,20 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                break;
                                        case IS_STRING:
                                        case IS_UNICODE: {
-                                               void *offset_key = Z_UNIVAL_P(offset);
+                                               zstr offset_key = Z_UNIVAL_P(offset);
                                                int  offset_len  = Z_UNILEN_P(offset);
                                                int free_offset = 0;
 
                                                if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) {
                                                        /* Identifier normalization */
                                                        UChar *norm;
-                                                       int32_t norm_len;
+                                                       int norm_len;
 
                                                        if (!zend_normalize_identifier(&norm, &norm_len,
-                                                                                      (UChar*)offset_key, offset_len, 0)) {
-                                                               zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key);
-                                                       } else if ((char*)norm != offset_key) {
-                                                               offset_key = (char*)norm;
+                                                                                      offset_key.u, offset_len, 0)) {
+                                                               zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key.u);
+                                                       } else if (norm != offset_key.u) {
+                                                               offset_key.u = norm;
                                                                offset_len = norm_len;
                                                                free_offset = 1;
                                                        }
@@ -19009,7 +19002,7 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                                        for (i = 0; i < ex->op_array->last_var; i++) {
                                                                                if (ex->op_array->vars[i].hash_value == hash_value &&
                                                                                    ex->op_array->vars[i].name_len == offset_len &&
-                                                                                   !memcmp(ex->op_array->vars[i].name, offset_key, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) {
+                                                                                   !memcmp(ex->op_array->vars[i].name.v, offset_key.v, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) {
                                                                                        ex->CVs[i] = NULL;
                                                                                        break;
                                                                                }
@@ -19018,7 +19011,7 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                        }
                                                }
                                                if (free_offset) {
-                                                       efree(offset_key);
+                                                       efree(offset_key.v);
                                                }
                                                break;
                                        }
@@ -19127,20 +19120,19 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV(int prop_dim,
                                        break;
                                case IS_STRING:
                                case IS_UNICODE: {
-                                       char *offset_key = Z_UNIVAL_P(offset);
-                                       int   offset_len = Z_UNILEN_P(offset);
-                                       int   free_offset = 0;
+                                       zstr offset_key = Z_UNIVAL_P(offset);
+                                       int  offset_len = Z_UNILEN_P(offset);
+                                       int  free_offset = 0;
 
                                        if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) {
                                                /* Identifier normalization */
                                                UChar *norm;
-                                               int32_t norm_len;
+                                               int norm_len;
 
-                                               if (!zend_normalize_identifier(&norm, &norm_len,
-                                                                              (UChar*)offset_key, offset_len, 0)) {
+                                               if (!zend_normalize_identifier(&norm, &norm_len, offset_key.u, offset_len, 0)) {
                                                        zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key);
-                                               } else if ((char*)norm != offset_key) {
-                                                       offset_key = (char*)norm;
+                                               } else if (norm != offset_key.u) {
+                                                       offset_key.u = norm;
                                                        offset_len = norm_len;
                                                        free_offset = 1;
                                                }
@@ -19149,7 +19141,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV(int prop_dim,
                                                isset = 1;
                                        }
                                        if (free_offset) {
-                                               efree(offset_key);
+                                               efree(offset_key.v);
                                        }
                                        break;
                                }
@@ -19730,7 +19722,7 @@ return_by_value:
 
                if (EG(ze1_compatibility_mode) && Z_TYPE_P(retval_ptr) == IS_OBJECT) {
                        zval *ret;
-                       char *class_name;
+                       zstr class_name;
                        zend_uint class_name_len;
                        int dup;
 
@@ -19738,13 +19730,13 @@ return_by_value:
                        INIT_PZVAL_COPY(ret, retval_ptr);
                        dup = zend_get_object_classname(retval_ptr, &class_name, &class_name_len TSRMLS_CC);
                        if (Z_OBJ_HT_P(retval_ptr)->clone_obj == NULL) {
-                               zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v",  Z_OBJCE_P(retval_ptr)->name);
+                               zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v",  class_name);
                        }
-                       zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", Z_OBJCE_P(retval_ptr)->name);
+                       zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name);
                        Z_OBJVAL_P(ret) = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC);
                        *EG(return_value_ptr_ptr) = ret;
                        if (!dup) {
-                               efree(class_name);
+                               efree(class_name.v);
                        }
                } else if (!0) { /* Not a temp var */
                        if (EG(active_op_array)->return_reference == ZEND_RETURN_REF ||
@@ -19959,13 +19951,13 @@ static int ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                        /* Ensure that if we're calling a private function, we're allowed to do so.
                         */
                        if (ce != EG(scope)) {
-                               zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR);
+                               zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR);
                        }
                } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
                        /* Ensure that if we're calling a protected function, we're allowed to do so.
                         */
                        if (!zend_check_protected(clone->common.scope, EG(scope))) {
-                               zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR);
+                               zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR);
                        }
                }
        }
@@ -20198,7 +20190,7 @@ static int ZEND_UNSET_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                        for (i = 0; i < ex->op_array->last_var; i++) {
                                                if (ex->op_array->vars[i].hash_value == hash_value &&
                                                    ex->op_array->vars[i].name_len == Z_UNILEN_P(varname) &&
-                                                   !memcmp(ex->op_array->vars[i].name, Z_UNIVAL_P(varname), Z_TYPE_P(varname)==IS_UNICODE?UBYTES(Z_UNILEN_P(varname)):Z_UNILEN_P(varname))) {
+                                                   !memcmp(ex->op_array->vars[i].name.v, Z_UNIVAL_P(varname).v, Z_TYPE_P(varname)==IS_UNICODE?UBYTES(Z_UNILEN_P(varname)):Z_UNILEN_P(varname))) {
                                                        ex->CVs[i] = NULL;
                                                        break;
                                                }
@@ -20309,7 +20301,7 @@ static int ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                if (ce) {
                        zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC);
                        while (zend_hash_has_more_elements(fe_ht) == SUCCESS) {
-                               char *str_key;
+                               zstr str_key;
                                uint str_key_len;
                                ulong int_key;
                                zend_uchar key_type;
@@ -20459,7 +20451,7 @@ static int ZEND_U_NORMALIZE_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                zval var_copy;
                int use_copy;
                UChar *norm;
-               int32_t norm_len;
+               int norm_len;
 
                zend_make_unicode_zval(result, &var_copy, &use_copy);
                if (use_copy) {
@@ -21479,7 +21471,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 {
        zend_op *opline = EX(opline);
        zval *function_name;
-       char *function_name_strval;
+       zstr function_name_strval;
        int function_name_strlen;
 
        /* FIXME: type is default */
@@ -21674,20 +21666,20 @@ static int ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                break;
                                        case IS_STRING:
                                        case IS_UNICODE: {
-                                               void *offset_key = Z_UNIVAL_P(offset);
+                                               zstr offset_key = Z_UNIVAL_P(offset);
                                                int  offset_len  = Z_UNILEN_P(offset);
                                                int free_offset = 0;
 
                                                if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) {
                                                        /* Identifier normalization */
                                                        UChar *norm;
-                                                       int32_t norm_len;
+                                                       int norm_len;
 
                                                        if (!zend_normalize_identifier(&norm, &norm_len,
-                                                                                      (UChar*)offset_key, offset_len, 0)) {
-                                                               zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key);
-                                                       } else if ((char*)norm != offset_key) {
-                                                               offset_key = (char*)norm;
+                                                                                      offset_key.u, offset_len, 0)) {
+                                                               zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key.u);
+                                                       } else if (norm != offset_key.u) {
+                                                               offset_key.u = norm;
                                                                offset_len = norm_len;
                                                                free_offset = 1;
                                                        }
@@ -21705,7 +21697,7 @@ static int ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                                        for (i = 0; i < ex->op_array->last_var; i++) {
                                                                                if (ex->op_array->vars[i].hash_value == hash_value &&
                                                                                    ex->op_array->vars[i].name_len == offset_len &&
-                                                                                   !memcmp(ex->op_array->vars[i].name, offset_key, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) {
+                                                                                   !memcmp(ex->op_array->vars[i].name.v, offset_key.v, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) {
                                                                                        ex->CVs[i] = NULL;
                                                                                        break;
                                                                                }
@@ -21714,7 +21706,7 @@ static int ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                        }
                                                }
                                                if (free_offset) {
-                                                       efree(offset_key);
+                                                       efree(offset_key.v);
                                                }
                                                break;
                                        }
@@ -21823,20 +21815,19 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(int prop_dim, Z
                                        break;
                                case IS_STRING:
                                case IS_UNICODE: {
-                                       char *offset_key = Z_UNIVAL_P(offset);
-                                       int   offset_len = Z_UNILEN_P(offset);
-                                       int   free_offset = 0;
+                                       zstr offset_key = Z_UNIVAL_P(offset);
+                                       int  offset_len = Z_UNILEN_P(offset);
+                                       int  free_offset = 0;
 
                                        if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) {
                                                /* Identifier normalization */
                                                UChar *norm;
-                                               int32_t norm_len;
+                                               int norm_len;
 
-                                               if (!zend_normalize_identifier(&norm, &norm_len,
-                                                                              (UChar*)offset_key, offset_len, 0)) {
+                                               if (!zend_normalize_identifier(&norm, &norm_len, offset_key.u, offset_len, 0)) {
                                                        zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key);
-                                               } else if ((char*)norm != offset_key) {
-                                                       offset_key = (char*)norm;
+                                               } else if (norm != offset_key.u) {
+                                                       offset_key.u = norm;
                                                        offset_len = norm_len;
                                                        free_offset = 1;
                                                }
@@ -21845,7 +21836,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(int prop_dim, Z
                                                isset = 1;
                                        }
                                        if (free_offset) {
-                                               efree(offset_key);
+                                               efree(offset_key.v);
                                        }
                                        break;
                                }
@@ -22953,7 +22944,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 {
        zend_op *opline = EX(opline);
        zval *function_name;
-       char *function_name_strval;
+       zstr function_name_strval;
        int function_name_strlen;
        zend_free_op free_op2;
        /* FIXME: type is default */
@@ -23150,20 +23141,20 @@ static int ZEND_UNSET_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                break;
                                        case IS_STRING:
                                        case IS_UNICODE: {
-                                               void *offset_key = Z_UNIVAL_P(offset);
+                                               zstr offset_key = Z_UNIVAL_P(offset);
                                                int  offset_len  = Z_UNILEN_P(offset);
                                                int free_offset = 0;
 
                                                if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) {
                                                        /* Identifier normalization */
                                                        UChar *norm;
-                                                       int32_t norm_len;
+                                                       int norm_len;
 
                                                        if (!zend_normalize_identifier(&norm, &norm_len,
-                                                                                      (UChar*)offset_key, offset_len, 0)) {
-                                                               zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key);
-                                                       } else if ((char*)norm != offset_key) {
-                                                               offset_key = (char*)norm;
+                                                                                      offset_key.u, offset_len, 0)) {
+                                                               zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key.u);
+                                                       } else if (norm != offset_key.u) {
+                                                               offset_key.u = norm;
                                                                offset_len = norm_len;
                                                                free_offset = 1;
                                                        }
@@ -23181,7 +23172,7 @@ static int ZEND_UNSET_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                                        for (i = 0; i < ex->op_array->last_var; i++) {
                                                                                if (ex->op_array->vars[i].hash_value == hash_value &&
                                                                                    ex->op_array->vars[i].name_len == offset_len &&
-                                                                                   !memcmp(ex->op_array->vars[i].name, offset_key, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) {
+                                                                                   !memcmp(ex->op_array->vars[i].name.v, offset_key.v, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) {
                                                                                        ex->CVs[i] = NULL;
                                                                                        break;
                                                                                }
@@ -23190,7 +23181,7 @@ static int ZEND_UNSET_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                        }
                                                }
                                                if (free_offset) {
-                                                       efree(offset_key);
+                                                       efree(offset_key.v);
                                                }
                                                break;
                                        }
@@ -23299,20 +23290,19 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int prop_dim, ZEN
                                        break;
                                case IS_STRING:
                                case IS_UNICODE: {
-                                       char *offset_key = Z_UNIVAL_P(offset);
-                                       int   offset_len = Z_UNILEN_P(offset);
-                                       int   free_offset = 0;
+                                       zstr offset_key = Z_UNIVAL_P(offset);
+                                       int  offset_len = Z_UNILEN_P(offset);
+                                       int  free_offset = 0;
 
                                        if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) {
                                                /* Identifier normalization */
                                                UChar *norm;
-                                               int32_t norm_len;
+                                               int norm_len;
 
-                                               if (!zend_normalize_identifier(&norm, &norm_len,
-                                                                              (UChar*)offset_key, offset_len, 0)) {
+                                               if (!zend_normalize_identifier(&norm, &norm_len, offset_key.u, offset_len, 0)) {
                                                        zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key);
-                                               } else if ((char*)norm != offset_key) {
-                                                       offset_key = (char*)norm;
+                                               } else if (norm != offset_key.u) {
+                                                       offset_key.u = norm;
                                                        offset_len = norm_len;
                                                        free_offset = 1;
                                                }
@@ -23321,7 +23311,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int prop_dim, ZEN
                                                isset = 1;
                                        }
                                        if (free_offset) {
-                                               efree(offset_key);
+                                               efree(offset_key.v);
                                        }
                                        break;
                                }
@@ -24466,7 +24456,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 {
        zend_op *opline = EX(opline);
        zval *function_name;
-       char *function_name_strval;
+       zstr function_name_strval;
        int function_name_strlen;
        zend_free_op free_op2;
        /* FIXME: type is default */
@@ -24663,20 +24653,20 @@ static int ZEND_UNSET_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                break;
                                        case IS_STRING:
                                        case IS_UNICODE: {
-                                               void *offset_key = Z_UNIVAL_P(offset);
+                                               zstr offset_key = Z_UNIVAL_P(offset);
                                                int  offset_len  = Z_UNILEN_P(offset);
                                                int free_offset = 0;
 
                                                if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) {
                                                        /* Identifier normalization */
                                                        UChar *norm;
-                                                       int32_t norm_len;
+                                                       int norm_len;
 
                                                        if (!zend_normalize_identifier(&norm, &norm_len,
-                                                                                      (UChar*)offset_key, offset_len, 0)) {
-                                                               zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key);
-                                                       } else if ((char*)norm != offset_key) {
-                                                               offset_key = (char*)norm;
+                                                                                      offset_key.u, offset_len, 0)) {
+                                                               zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key.u);
+                                                       } else if (norm != offset_key.u) {
+                                                               offset_key.u = norm;
                                                                offset_len = norm_len;
                                                                free_offset = 1;
                                                        }
@@ -24694,7 +24684,7 @@ static int ZEND_UNSET_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                                        for (i = 0; i < ex->op_array->last_var; i++) {
                                                                                if (ex->op_array->vars[i].hash_value == hash_value &&
                                                                                    ex->op_array->vars[i].name_len == offset_len &&
-                                                                                   !memcmp(ex->op_array->vars[i].name, offset_key, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) {
+                                                                                   !memcmp(ex->op_array->vars[i].name.v, offset_key.v, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) {
                                                                                        ex->CVs[i] = NULL;
                                                                                        break;
                                                                                }
@@ -24703,7 +24693,7 @@ static int ZEND_UNSET_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                        }
                                                }
                                                if (free_offset) {
-                                                       efree(offset_key);
+                                                       efree(offset_key.v);
                                                }
                                                break;
                                        }
@@ -24812,20 +24802,19 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int prop_dim, ZEN
                                        break;
                                case IS_STRING:
                                case IS_UNICODE: {
-                                       char *offset_key = Z_UNIVAL_P(offset);
-                                       int   offset_len = Z_UNILEN_P(offset);
-                                       int   free_offset = 0;
+                                       zstr offset_key = Z_UNIVAL_P(offset);
+                                       int  offset_len = Z_UNILEN_P(offset);
+                                       int  free_offset = 0;
 
                                        if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) {
                                                /* Identifier normalization */
                                                UChar *norm;
-                                               int32_t norm_len;
+                                               int norm_len;
 
-                                               if (!zend_normalize_identifier(&norm, &norm_len,
-                                                                              (UChar*)offset_key, offset_len, 0)) {
+                                               if (!zend_normalize_identifier(&norm, &norm_len, offset_key.u, offset_len, 0)) {
                                                        zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key);
-                                               } else if ((char*)norm != offset_key) {
-                                                       offset_key = (char*)norm;
+                                               } else if (norm != offset_key.u) {
+                                                       offset_key.u = norm;
                                                        offset_len = norm_len;
                                                        free_offset = 1;
                                                }
@@ -24834,7 +24823,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int prop_dim, ZEN
                                                isset = 1;
                                        }
                                        if (free_offset) {
-                                               efree(offset_key);
+                                               efree(offset_key.v);
                                        }
                                        break;
                                }
@@ -26383,7 +26372,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 {
        zend_op *opline = EX(opline);
        zval *function_name;
-       char *function_name_strval;
+       zstr function_name_strval;
        int function_name_strlen;
 
        /* FIXME: type is default */
@@ -26578,20 +26567,20 @@ static int ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                break;
                                        case IS_STRING:
                                        case IS_UNICODE: {
-                                               void *offset_key = Z_UNIVAL_P(offset);
+                                               zstr offset_key = Z_UNIVAL_P(offset);
                                                int  offset_len  = Z_UNILEN_P(offset);
                                                int free_offset = 0;
 
                                                if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) {
                                                        /* Identifier normalization */
                                                        UChar *norm;
-                                                       int32_t norm_len;
+                                                       int norm_len;
 
                                                        if (!zend_normalize_identifier(&norm, &norm_len,
-                                                                                      (UChar*)offset_key, offset_len, 0)) {
-                                                               zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key);
-                                                       } else if ((char*)norm != offset_key) {
-                                                               offset_key = (char*)norm;
+                                                                                      offset_key.u, offset_len, 0)) {
+                                                               zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key.u);
+                                                       } else if (norm != offset_key.u) {
+                                                               offset_key.u = norm;
                                                                offset_len = norm_len;
                                                                free_offset = 1;
                                                        }
@@ -26609,7 +26598,7 @@ static int ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                                        for (i = 0; i < ex->op_array->last_var; i++) {
                                                                                if (ex->op_array->vars[i].hash_value == hash_value &&
                                                                                    ex->op_array->vars[i].name_len == offset_len &&
-                                                                                   !memcmp(ex->op_array->vars[i].name, offset_key, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) {
+                                                                                   !memcmp(ex->op_array->vars[i].name.v, offset_key.v, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) {
                                                                                        ex->CVs[i] = NULL;
                                                                                        break;
                                                                                }
@@ -26618,7 +26607,7 @@ static int ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                                                        }
                                                }
                                                if (free_offset) {
-                                                       efree(offset_key);
+                                                       efree(offset_key.v);
                                                }
                                                break;
                                        }
@@ -26727,20 +26716,19 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int prop_dim, ZEND
                                        break;
                                case IS_STRING:
                                case IS_UNICODE: {
-                                       char *offset_key = Z_UNIVAL_P(offset);
-                                       int   offset_len = Z_UNILEN_P(offset);
-                                       int   free_offset = 0;
+                                       zstr offset_key = Z_UNIVAL_P(offset);
+                                       int  offset_len = Z_UNILEN_P(offset);
+                                       int  free_offset = 0;
 
                                        if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) {
                                                /* Identifier normalization */
                                                UChar *norm;
-                                               int32_t norm_len;
+                                               int norm_len;
 
-                                               if (!zend_normalize_identifier(&norm, &norm_len,
-                                                                              (UChar*)offset_key, offset_len, 0)) {
+                                               if (!zend_normalize_identifier(&norm, &norm_len, offset_key.u, offset_len, 0)) {
                                                        zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key);
-                                               } else if ((char*)norm != offset_key) {
-                                                       offset_key = (char*)norm;
+                                               } else if (norm != offset_key.u) {
+                                                       offset_key.u = norm;
                                                        offset_len = norm_len;
                                                        free_offset = 1;
                                                }
@@ -26749,7 +26737,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int prop_dim, ZEND
                                                isset = 1;
                                        }
                                        if (free_offset) {
-                                               efree(offset_key);
+                                               efree(offset_key.v);
                                        }
                                        break;
                                }
index 6fe782a3229ed7cbc12c0f8463ed7a2aebc3ba20..eae3e9ca1825f8edc85abdc1875ff0bd04c7ca8b 100644 (file)
@@ -149,7 +149,7 @@ static void php_dom_iterator_current_data(zend_object_iterator *iter, zval ***da
        *data = &iterator->curobj;
 }
 
-static int php_dom_iterator_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)
+static int php_dom_iterator_current_key(zend_object_iterator *iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)
 {
        zval *curobj;
        xmlNodePtr curnode = NULL;
@@ -173,7 +173,7 @@ static int php_dom_iterator_current_key(zend_object_iterator *iter, char **str_k
                }
 
                namelen = xmlStrlen(curnode->name);
-               *str_key = estrndup(curnode->name, namelen);
+               str_key->s = estrndup(curnode->name, namelen);
                *str_key_len = namelen + 1;
                return HASH_KEY_IS_STRING;
        }
index 72560bf6de800a6d6ad6f4a3592434ec80f7f1c1..607c2f72689416725921ed72ec60923843d89ed5 100644 (file)
@@ -580,19 +580,19 @@ PHP_MINIT_FUNCTION(dom)
        
        zend_hash_init(&dom_domstringlist_prop_handlers, 0, NULL, NULL, 1);
        dom_register_prop_handler(&dom_domstringlist_prop_handlers, "length", dom_domstringlist_length_read, NULL TSRMLS_CC);
-       zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_domstringlist_prop_handlers, sizeof(dom_domstringlist_prop_handlers), NULL);
+       zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_domstringlist_prop_handlers, sizeof(dom_domstringlist_prop_handlers), NULL);
 
        REGISTER_DOM_CLASS(ce, "DOMNameList", NULL, php_dom_namelist_class_functions, dom_namelist_class_entry);
        
        zend_hash_init(&dom_namelist_prop_handlers, 0, NULL, NULL, 1);
        dom_register_prop_handler(&dom_namelist_prop_handlers, "length", dom_namelist_length_read, NULL TSRMLS_CC);
-       zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_namelist_prop_handlers, sizeof(dom_namelist_prop_handlers), NULL);
+       zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_namelist_prop_handlers, sizeof(dom_namelist_prop_handlers), NULL);
 
        REGISTER_DOM_CLASS(ce, "DOMImplementationList", NULL, php_dom_domimplementationlist_class_functions, dom_domimplementationlist_class_entry);
        
        zend_hash_init(&dom_domimplementationlist_prop_handlers, 0, NULL, NULL, 1);
        dom_register_prop_handler(&dom_domimplementationlist_prop_handlers, "length", dom_domimplementationlist_length_read, NULL TSRMLS_CC);
-       zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_domimplementationlist_prop_handlers, sizeof(dom_domimplementationlist_prop_handlers), NULL);
+       zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_domimplementationlist_prop_handlers, sizeof(dom_domimplementationlist_prop_handlers), NULL);
 
        REGISTER_DOM_CLASS(ce, "DOMImplementationSource", NULL, php_dom_domimplementationsource_class_functions, dom_domimplementationsource_class_entry);
        REGISTER_DOM_CLASS(ce, "DOMImplementation", NULL, php_dom_domimplementation_class_functions, dom_domimplementation_class_entry);
@@ -616,7 +616,7 @@ PHP_MINIT_FUNCTION(dom)
        dom_register_prop_handler(&dom_node_prop_handlers, "localName", dom_node_local_name_read, NULL TSRMLS_CC);
        dom_register_prop_handler(&dom_node_prop_handlers, "baseURI", dom_node_base_uri_read, NULL TSRMLS_CC);
        dom_register_prop_handler(&dom_node_prop_handlers, "textContent", dom_node_text_content_read, dom_node_text_content_write TSRMLS_CC);
-       zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_node_prop_handlers, sizeof(dom_node_prop_handlers), NULL);
+       zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_node_prop_handlers, sizeof(dom_node_prop_handlers), NULL);
 
        REGISTER_DOM_CLASS(ce, "DOMNameSpaceNode", NULL, NULL, dom_namespace_node_class_entry);
 
@@ -629,12 +629,12 @@ PHP_MINIT_FUNCTION(dom)
        dom_register_prop_handler(&dom_namespace_node_prop_handlers, "namespaceURI", dom_node_namespace_uri_read, NULL TSRMLS_CC);
        dom_register_prop_handler(&dom_namespace_node_prop_handlers, "ownerDocument", dom_node_owner_document_read, NULL TSRMLS_CC);
        dom_register_prop_handler(&dom_namespace_node_prop_handlers, "parentNode", dom_node_parent_node_read, NULL TSRMLS_CC);
-       zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_namespace_node_prop_handlers, sizeof(dom_namespace_node_prop_handlers), NULL);
+       zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_namespace_node_prop_handlers, sizeof(dom_namespace_node_prop_handlers), NULL);
 
        REGISTER_DOM_CLASS(ce, "DOMDocumentFragment", dom_node_class_entry, php_dom_documentfragment_class_functions, dom_documentfragment_class_entry);
        zend_hash_init(&dom_document_fragment_prop_handlers, 0, NULL, NULL, 1);
        zend_hash_copy(&dom_document_fragment_prop_handlers, &dom_node_prop_handlers, NULL, NULL, sizeof(dom_prop_handler));
-       zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_document_fragment_prop_handlers, sizeof(dom_node_prop_handlers), NULL);
+       zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_document_fragment_prop_handlers, sizeof(dom_node_prop_handlers), NULL);
        
        REGISTER_DOM_CLASS(ce, "DOMDocument", dom_node_class_entry, php_dom_document_class_functions, dom_document_class_entry);
        zend_hash_init(&dom_document_prop_handlers, 0, NULL, NULL, 1);
@@ -659,7 +659,7 @@ PHP_MINIT_FUNCTION(dom)
        dom_register_prop_handler(&dom_document_prop_handlers, "substituteEntities", dom_document_substitue_entities_read, dom_document_substitue_entities_write TSRMLS_CC);
 
        zend_hash_merge(&dom_document_prop_handlers, &dom_node_prop_handlers, NULL, NULL, sizeof(dom_prop_handler), 0);
-       zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_document_prop_handlers, sizeof(dom_document_prop_handlers), NULL);
+       zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_document_prop_handlers, sizeof(dom_document_prop_handlers), NULL);
 
        INIT_CLASS_ENTRY(ce, "DOMNodeList", php_dom_nodelist_class_functions);
        ce.create_object = dom_nnodemap_objects_new;
@@ -668,7 +668,7 @@ PHP_MINIT_FUNCTION(dom)
 
        zend_hash_init(&dom_nodelist_prop_handlers, 0, NULL, NULL, 1);
        dom_register_prop_handler(&dom_nodelist_prop_handlers, "length", dom_nodelist_length_read, NULL TSRMLS_CC);
-       zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_nodelist_prop_handlers, sizeof(dom_nodelist_prop_handlers), NULL);
+       zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_nodelist_prop_handlers, sizeof(dom_nodelist_prop_handlers), NULL);
 
        INIT_CLASS_ENTRY(ce, "DOMNamedNodeMap", php_dom_namednodemap_class_functions);
        ce.create_object = dom_nnodemap_objects_new;
@@ -677,7 +677,7 @@ PHP_MINIT_FUNCTION(dom)
 
        zend_hash_init(&dom_namednodemap_prop_handlers, 0, NULL, NULL, 1);
        dom_register_prop_handler(&dom_namednodemap_prop_handlers, "length", dom_namednodemap_length_read, NULL TSRMLS_CC);
-       zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_namednodemap_prop_handlers, sizeof(dom_namednodemap_prop_handlers), NULL);
+       zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_namednodemap_prop_handlers, sizeof(dom_namednodemap_prop_handlers), NULL);
 
        REGISTER_DOM_CLASS(ce, "DOMCharacterData", dom_node_class_entry, php_dom_characterdata_class_functions, dom_characterdata_class_entry);
        
@@ -685,7 +685,7 @@ PHP_MINIT_FUNCTION(dom)
        dom_register_prop_handler(&dom_characterdata_prop_handlers, "data", dom_characterdata_data_read, dom_characterdata_data_write TSRMLS_CC);
        dom_register_prop_handler(&dom_characterdata_prop_handlers, "length", dom_characterdata_length_read, NULL TSRMLS_CC);
        zend_hash_merge(&dom_characterdata_prop_handlers, &dom_node_prop_handlers, NULL, NULL, sizeof(dom_prop_handler), 0);
-       zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_characterdata_prop_handlers, sizeof(dom_characterdata_prop_handlers), NULL);
+       zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_characterdata_prop_handlers, sizeof(dom_characterdata_prop_handlers), NULL);
 
        REGISTER_DOM_CLASS(ce, "DOMAttr", dom_node_class_entry, php_dom_attr_class_functions, dom_attr_class_entry);
        
@@ -696,7 +696,7 @@ PHP_MINIT_FUNCTION(dom)
        dom_register_prop_handler(&dom_attr_prop_handlers, "ownerElement", dom_attr_owner_element_read, NULL TSRMLS_CC);
        dom_register_prop_handler(&dom_attr_prop_handlers, "schemaTypeInfo", dom_attr_schema_type_info_read, NULL TSRMLS_CC);
        zend_hash_merge(&dom_attr_prop_handlers, &dom_node_prop_handlers, NULL, NULL, sizeof(dom_prop_handler), 0);
-       zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_attr_prop_handlers, sizeof(dom_attr_prop_handlers), NULL);
+       zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_attr_prop_handlers, sizeof(dom_attr_prop_handlers), NULL);
 
        REGISTER_DOM_CLASS(ce, "DOMElement", dom_node_class_entry, php_dom_element_class_functions, dom_element_class_entry);
        
@@ -704,26 +704,26 @@ PHP_MINIT_FUNCTION(dom)
        dom_register_prop_handler(&dom_element_prop_handlers, "tagName", dom_element_tag_name_read, NULL TSRMLS_CC);
        dom_register_prop_handler(&dom_element_prop_handlers, "schemaTypeInfo", dom_element_schema_type_info_read, NULL TSRMLS_CC);
        zend_hash_merge(&dom_element_prop_handlers, &dom_node_prop_handlers, NULL, NULL, sizeof(dom_prop_handler), 0);
-       zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_element_prop_handlers, sizeof(dom_element_prop_handlers), NULL);
+       zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_element_prop_handlers, sizeof(dom_element_prop_handlers), NULL);
 
        REGISTER_DOM_CLASS(ce, "DOMText", dom_characterdata_class_entry, php_dom_text_class_functions, dom_text_class_entry);
        
        zend_hash_init(&dom_text_prop_handlers, 0, NULL, NULL, 1);
        dom_register_prop_handler(&dom_text_prop_handlers, "wholeText", dom_text_whole_text_read, NULL TSRMLS_CC);
        zend_hash_merge(&dom_text_prop_handlers, &dom_characterdata_prop_handlers, NULL, NULL, sizeof(dom_prop_handler), 0);
-       zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_text_prop_handlers, sizeof(dom_text_prop_handlers), NULL);
+       zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_text_prop_handlers, sizeof(dom_text_prop_handlers), NULL);
 
        REGISTER_DOM_CLASS(ce, "DOMComment", dom_characterdata_class_entry, php_dom_comment_class_functions, dom_comment_class_entry);
        zend_hash_init(&dom_comment_prop_handlers, 0, NULL, NULL, 1);
        zend_hash_copy(&dom_comment_prop_handlers, &dom_node_prop_handlers, NULL, NULL, sizeof(dom_prop_handler));
-       zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_comment_prop_handlers, sizeof(dom_typeinfo_prop_handlers), NULL);
+       zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_comment_prop_handlers, sizeof(dom_typeinfo_prop_handlers), NULL);
 
        REGISTER_DOM_CLASS(ce, "DOMTypeinfo", NULL, php_dom_typeinfo_class_functions, dom_typeinfo_class_entry);
        
        zend_hash_init(&dom_typeinfo_prop_handlers, 0, NULL, NULL, 1);
        dom_register_prop_handler(&dom_typeinfo_prop_handlers, "typeName", dom_typeinfo_type_name_read, NULL TSRMLS_CC);
        dom_register_prop_handler(&dom_typeinfo_prop_handlers, "typeNamespace", dom_typeinfo_type_namespace_read, NULL TSRMLS_CC);
-       zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_typeinfo_prop_handlers, sizeof(dom_typeinfo_prop_handlers), NULL);
+       zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_typeinfo_prop_handlers, sizeof(dom_typeinfo_prop_handlers), NULL);
 
        REGISTER_DOM_CLASS(ce, "DOMUserDataHandler", NULL, php_dom_userdatahandler_class_functions, dom_userdatahandler_class_entry);
        REGISTER_DOM_CLASS(ce, "DOMDomError", NULL, php_dom_domerror_class_functions, dom_domerror_class_entry);
@@ -735,7 +735,7 @@ PHP_MINIT_FUNCTION(dom)
        dom_register_prop_handler(&dom_domerror_prop_handlers, "relatedException", dom_domerror_related_exception_read, NULL TSRMLS_CC);
        dom_register_prop_handler(&dom_domerror_prop_handlers, "related_data", dom_domerror_related_data_read, NULL TSRMLS_CC);
        dom_register_prop_handler(&dom_domerror_prop_handlers, "location", dom_domerror_location_read, NULL TSRMLS_CC);
-       zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_domerror_prop_handlers, sizeof(dom_domerror_prop_handlers), NULL);
+       zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_domerror_prop_handlers, sizeof(dom_domerror_prop_handlers), NULL);
 
        REGISTER_DOM_CLASS(ce, "DOMErrorHandler", NULL, php_dom_domerrorhandler_class_functions, dom_domerrorhandler_class_entry);
        REGISTER_DOM_CLASS(ce, "DOMLocator", NULL, php_dom_domlocator_class_functions, dom_domlocator_class_entry);
@@ -746,13 +746,13 @@ PHP_MINIT_FUNCTION(dom)
        dom_register_prop_handler(&dom_domlocator_prop_handlers, "offset", dom_domlocator_offset_read, NULL TSRMLS_CC);
        dom_register_prop_handler(&dom_domlocator_prop_handlers, "relatedNode", dom_domlocator_related_node_read, NULL TSRMLS_CC);
        dom_register_prop_handler(&dom_domlocator_prop_handlers, "uri", dom_domlocator_uri_read, NULL TSRMLS_CC);
-       zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_domlocator_prop_handlers, sizeof(dom_domlocator_prop_handlers), NULL);
+       zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_domlocator_prop_handlers, sizeof(dom_domlocator_prop_handlers), NULL);
 
        REGISTER_DOM_CLASS(ce, "DOMConfiguration", NULL, php_dom_domconfiguration_class_functions, dom_domconfiguration_class_entry);
        REGISTER_DOM_CLASS(ce, "DOMCdataSection", dom_text_class_entry, php_dom_cdatasection_class_functions, dom_cdatasection_class_entry);
        zend_hash_init(&dom_cdata_prop_handlers, 0, NULL, NULL, 1);
        zend_hash_copy(&dom_cdata_prop_handlers, &dom_text_prop_handlers, NULL, NULL, sizeof(dom_prop_handler));
-       zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_cdata_prop_handlers, sizeof(dom_documenttype_prop_handlers), NULL);
+       zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_cdata_prop_handlers, sizeof(dom_documenttype_prop_handlers), NULL);
 
        REGISTER_DOM_CLASS(ce, "DOMDocumentType", dom_node_class_entry, php_dom_documenttype_class_functions, dom_documenttype_class_entry);
        
@@ -764,7 +764,7 @@ PHP_MINIT_FUNCTION(dom)
        dom_register_prop_handler(&dom_documenttype_prop_handlers, "systemId", dom_documenttype_system_id_read, NULL TSRMLS_CC);
        dom_register_prop_handler(&dom_documenttype_prop_handlers, "internalSubset", dom_documenttype_internal_subset_read, NULL TSRMLS_CC);
        zend_hash_merge(&dom_documenttype_prop_handlers, &dom_node_prop_handlers, NULL, NULL, sizeof(dom_prop_handler), 0);
-       zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_documenttype_prop_handlers, sizeof(dom_documenttype_prop_handlers), NULL);
+       zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_documenttype_prop_handlers, sizeof(dom_documenttype_prop_handlers), NULL);
 
        REGISTER_DOM_CLASS(ce, "DOMNotation", NULL, php_dom_notation_class_functions, dom_notation_class_entry);
        
@@ -775,7 +775,7 @@ PHP_MINIT_FUNCTION(dom)
        dom_register_prop_handler(&dom_notation_prop_handlers, "nodeName", dom_node_node_name_read, NULL TSRMLS_CC);
        dom_register_prop_handler(&dom_notation_prop_handlers, "nodeValue", dom_node_node_value_read, dom_node_node_value_write TSRMLS_CC);
        dom_register_prop_handler(&dom_notation_prop_handlers, "attributes", dom_node_attributes_read, NULL TSRMLS_CC);
-       zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_notation_prop_handlers, sizeof(dom_notation_prop_handlers), NULL);
+       zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_notation_prop_handlers, sizeof(dom_notation_prop_handlers), NULL);
 
        REGISTER_DOM_CLASS(ce, "DOMEntity", dom_node_class_entry, php_dom_entity_class_functions, dom_entity_class_entry);
        
@@ -788,12 +788,12 @@ PHP_MINIT_FUNCTION(dom)
        dom_register_prop_handler(&dom_entity_prop_handlers, "version", dom_entity_version_read, dom_entity_version_write TSRMLS_CC);
        zend_hash_merge(&dom_entity_prop_handlers, &dom_node_prop_handlers, NULL, NULL, sizeof(dom_prop_handler), 0);
 
-       zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_entity_prop_handlers, sizeof(dom_entity_prop_handlers), NULL);
+       zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_entity_prop_handlers, sizeof(dom_entity_prop_handlers), NULL);
 
        REGISTER_DOM_CLASS(ce, "DOMEntityReference", dom_node_class_entry, php_dom_entityreference_class_functions, dom_entityreference_class_entry);
        zend_hash_init(&dom_entity_reference_prop_handlers, 0, NULL, NULL, 1);
        zend_hash_copy(&dom_entity_reference_prop_handlers, &dom_node_prop_handlers, NULL, NULL, sizeof(dom_prop_handler));
-       zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_entity_reference_prop_handlers, sizeof(dom_entity_prop_handlers), NULL);
+       zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_entity_reference_prop_handlers, sizeof(dom_entity_prop_handlers), NULL);
 
        REGISTER_DOM_CLASS(ce, "DOMProcessingInstruction", dom_node_class_entry, php_dom_processinginstruction_class_functions, dom_processinginstruction_class_entry);
        
@@ -801,7 +801,7 @@ PHP_MINIT_FUNCTION(dom)
        dom_register_prop_handler(&dom_processinginstruction_prop_handlers, "target", dom_processinginstruction_target_read, NULL TSRMLS_CC);
        dom_register_prop_handler(&dom_processinginstruction_prop_handlers, "data", dom_processinginstruction_data_read, dom_processinginstruction_data_write TSRMLS_CC);
        zend_hash_merge(&dom_processinginstruction_prop_handlers, &dom_node_prop_handlers, NULL, NULL, sizeof(dom_prop_handler), 0);
-       zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_processinginstruction_prop_handlers, sizeof(dom_processinginstruction_prop_handlers), NULL);
+       zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_processinginstruction_prop_handlers, sizeof(dom_processinginstruction_prop_handlers), NULL);
 
        REGISTER_DOM_CLASS(ce, "DOMStringExtend", NULL, php_dom_string_extend_class_functions, dom_string_extend_class_entry);
 
@@ -812,7 +812,7 @@ PHP_MINIT_FUNCTION(dom)
 
        zend_hash_init(&dom_xpath_prop_handlers, 0, NULL, NULL, 1);
        dom_register_prop_handler(&dom_xpath_prop_handlers, "document", dom_xpath_document_read, NULL TSRMLS_CC);
-       zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_xpath_prop_handlers, sizeof(dom_xpath_prop_handlers), NULL);
+       zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_xpath_prop_handlers, sizeof(dom_xpath_prop_handlers), NULL);
 #endif
 
        REGISTER_LONG_CONSTANT("XML_ELEMENT_NODE",                      XML_ELEMENT_NODE,                       CONST_CS | CONST_PERSISTENT);
index 25382eaf4dc13337b5c643f8f17a02673fbeebe9..21f2f5a13e16a9256857cc5f9fa8742fbe4ea54c 100644 (file)
@@ -472,7 +472,7 @@ Return a list of registered hashing algorithms */
 PHP_FUNCTION(hash_algos)
 {
        HashPosition pos;
-       char *str;
+       zstr str;
        int str_len;
        long idx, type;
 
@@ -480,7 +480,7 @@ PHP_FUNCTION(hash_algos)
        for(zend_hash_internal_pointer_reset_ex(&php_hash_hashtable, &pos);
                (type = zend_hash_get_current_key_ex(&php_hash_hashtable, &str, &str_len, &idx, 0, &pos)) != HASH_KEY_NON_EXISTANT;
                zend_hash_move_forward_ex(&php_hash_hashtable, &pos)) {
-               add_next_index_stringl(return_value, str, str_len-1, 1);
+               add_next_index_stringl(return_value, str.s, str_len-1, 1);
        }
 }
 /* }}} */
@@ -577,13 +577,14 @@ PHP_MINFO_FUNCTION(hash)
 {
        HashPosition pos;
        char buffer[2048];
-       char *s = buffer, *e = s + sizeof(buffer), *str;
+       char *s = buffer, *e = s + sizeof(buffer);
+       zstr str;
        long idx, type;
 
        for(zend_hash_internal_pointer_reset_ex(&php_hash_hashtable, &pos);
                (type = zend_hash_get_current_key_ex(&php_hash_hashtable, &str, NULL, &idx, 0, &pos)) != HASH_KEY_NON_EXISTANT;
                zend_hash_move_forward_ex(&php_hash_hashtable, &pos)) {
-               s += snprintf(s, e - s, "%s ", str);
+               s += snprintf(s, e - s, "%s ", str.s);
        }
        *s = 0;
 
index 9db4d5419298be84292f93a502aff00fd43cc4b6..e38940f38a44feb7170e76f4e607232102ced164 100644 (file)
@@ -841,17 +841,17 @@ int php_libxml_register_export(zend_class_entry *ce, php_libxml_export_node expo
        php_libxml_initialize();
        export_hnd.export_func = export_function;
 
-       if (zend_hash_add(&php_libxml_exports, ce->name, ce->name_length + 1, &export_hnd, sizeof(export_hnd), NULL) == SUCCESS) {
+       if (zend_hash_add(&php_libxml_exports, ce->name.s, ce->name_length + 1, &export_hnd, sizeof(export_hnd), NULL) == SUCCESS) {
                int ret;
                UChar *uname;
 
                uname = malloc(UBYTES(ce->name_length+1));
-               u_charsToUChars(ce->name, uname, ce->name_length+1);
-    ret = zend_u_hash_add(&php_libxml_exports, IS_UNICODE, uname, ce->name_length + 1, &export_hnd, sizeof(export_hnd), NULL);
-    free(uname);
-    return ret;
-  }
-  return FAILURE;
+               u_charsToUChars(ce->name.s, uname, ce->name_length+1);
+               ret = zend_u_hash_add(&php_libxml_exports, IS_UNICODE, (zstr)uname, ce->name_length + 1, &export_hnd, sizeof(export_hnd), NULL);
+               free(uname);
+               return ret;
+       }
+       return FAILURE;
 }
 
 PHP_LIBXML_API xmlNodePtr php_libxml_import_node(zval *object TSRMLS_DC)
index 66b0eb92d5a8e9af6e51339db02b59b9dc369164..b9288c6bf63c464cbca07f35996330dba0f7bb49 100644 (file)
@@ -1380,8 +1380,9 @@ PHP_FUNCTION(mysql_db_query)
                        WRONG_PARAM_COUNT;
                        break;
        }
-       
-       if (MySG(trace_mode) || !strcasecmp(get_active_function_name(TSRMLS_C), "mysql")) {
+
+       /* FIXME: Unicode support??? */
+       if (MySG(trace_mode) || !strcasecmp(get_active_function_name(TSRMLS_C).s, "mysql")) {
                php_error_docref(NULL TSRMLS_CC, E_NOTICE, "This function is deprecated; use mysql_query() instead.");
        }
        
index a07c50cd24364163770f405966cf6d52286aff5d..c926dcb09ae976a0d3fa6e8b4d1425b399721d5d 100644 (file)
@@ -1244,17 +1244,18 @@ static int php_openssl_make_REQ(struct php_x509_request * req, X509_REQ * csr, z
                /* apply values from the dn hash */
                zend_hash_internal_pointer_reset_ex(HASH_OF(dn), &hpos);
                while(zend_hash_get_current_data_ex(HASH_OF(dn), (void**)&item, &hpos) == SUCCESS) {
-                       char * strindex; int strindexlen;
+                       zstr strindex;
+                       int strindexlen;
                        long intindex;
                        
                        zend_hash_get_current_key_ex(HASH_OF(dn), &strindex, &strindexlen, &intindex, 0, &hpos);
 
                        convert_to_string_ex(item);
 
-                       if (strindex) {
+                       if (strindex.s) {
                                int nid;
 
-                               nid = OBJ_txt2nid(strindex);
+                               nid = OBJ_txt2nid(strindex.s);
                                if (nid != NID_undef) {
                                        if (!X509_NAME_add_entry_by_NID(subj, nid, MBSTRING_ASC, 
                                                                (unsigned char*)Z_STRVAL_PP(item), -1, -1, 0))
@@ -1263,7 +1264,7 @@ static int php_openssl_make_REQ(struct php_x509_request * req, X509_REQ * csr, z
                                                return FAILURE;
                                        }
                                } else {
-                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "dn: %s is not a recognized name", strindex);
+                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "dn: %s is not a recognized name", strindex.s);
                                }
                        }
                        zend_hash_move_forward_ex(HASH_OF(dn), &hpos);
@@ -1318,23 +1319,24 @@ static int php_openssl_make_REQ(struct php_x509_request * req, X509_REQ * csr, z
                if (attribs) {
                        zend_hash_internal_pointer_reset_ex(HASH_OF(attribs), &hpos);
                        while(zend_hash_get_current_data_ex(HASH_OF(attribs), (void**)&item, &hpos) == SUCCESS) {
-                               char * strindex; int strindexlen;
+                               zstr strindex;
+                               int strindexlen;
                                long intindex;
 
                                zend_hash_get_current_key_ex(HASH_OF(attribs), &strindex, &strindexlen, &intindex, 0, &hpos);
                                convert_to_string_ex(item);
 
-                               if (strindex) {
+                               if (strindex.s) {
                                        int nid;
 
-                                       nid = OBJ_txt2nid(strindex);
+                                       nid = OBJ_txt2nid(strindex.s);
                                        if (nid != NID_undef) {
                                                if (!X509_NAME_add_entry_by_NID(subj, nid, MBSTRING_ASC, (unsigned char*)Z_STRVAL_PP(item), -1, -1, 0)) {
                                                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "attribs: add_entry_by_NID %d -> %s (failed)", nid, Z_STRVAL_PP(item));
                                                        return FAILURE;
                                                }
                                        } else {
-                                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "dn: %s is not a recognized name", strindex);
+                                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "dn: %s is not a recognized name", strindex.s);
                                        }
                                }
                                zend_hash_move_forward_ex(HASH_OF(attribs), &hpos);
@@ -2264,7 +2266,7 @@ PHP_FUNCTION(openssl_pkcs7_encrypt)
        long cipherid = PHP_OPENSSL_CIPHER_DEFAULT;
        uint strindexlen;
        ulong intindex;
-       char * strindex;
+       zstr strindex;
        char * infilename = NULL;       int infilename_len;
        char * outfilename = NULL;      int outfilename_len;
        
@@ -2375,8 +2377,8 @@ PHP_FUNCTION(openssl_pkcs7_encrypt)
 
                        convert_to_string_ex(zcertval);
 
-                       if (strindex) {
-                               BIO_printf(outfile, "%s: %s\n", strindex, Z_STRVAL_PP(zcertval));
+                       if (strindex.s) {
+                               BIO_printf(outfile, "%s: %s\n", strindex.s, Z_STRVAL_PP(zcertval));
                        } else {
                                BIO_printf(outfile, "%s\n", Z_STRVAL_PP(zcertval));
                        }
@@ -2419,7 +2421,7 @@ PHP_FUNCTION(openssl_pkcs7_sign)
        ulong intindex;
        uint strindexlen;
        HashPosition hpos;
-       char * strindex;
+       zstr strindex;
        char * infilename;      int infilename_len;
        char * outfilename;     int outfilename_len;
        char * extracertsfilename = NULL; int extracertsfilename_len;
@@ -2484,8 +2486,8 @@ PHP_FUNCTION(openssl_pkcs7_sign)
 
                        convert_to_string_ex(hval);
 
-                       if (strindex) {
-                               BIO_printf(outfile, "%s: %s\n", strindex, Z_STRVAL_PP(hval));
+                       if (strindex.s) {
+                               BIO_printf(outfile, "%s: %s\n", strindex.s, Z_STRVAL_PP(hval));
                        } else {
                                BIO_printf(outfile, "%s\n", Z_STRVAL_PP(hval));
                        }
index 95487d0289451c7015fe0e810c493a29545c35b2..7fe4d2407805e5cdc497376db7f9613673859eba 100644 (file)
@@ -1140,7 +1140,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_callabl
        char                    *result;
        int                              result_len;
        int                              limit_val = -1;
-       char                    *string_key;
+       zstr                     string_key;
        ulong                    num_key;
        zval                     callback_name;
     int                                replace_count=0;
@@ -1198,7 +1198,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_callabl
                                switch(zend_hash_get_current_key(Z_ARRVAL_PP(subject), &string_key, &num_key, 0))
                                {
                                        case HASH_KEY_IS_STRING:
-                                               add_assoc_stringl(return_value, string_key, result, result_len, 0);
+                                               add_assoc_stringl(return_value, string_key.s, result, result_len, 0);
                                                break;
 
                                        case HASH_KEY_IS_LONG:
@@ -1530,7 +1530,7 @@ PHP_FUNCTION(preg_grep)
        int                             *offsets;                       /* Array of subpattern offsets */
        int                              size_offsets;          /* Size of the offsets array */
        int                              count = 0;                     /* Count of matched subpatterns */
-       char                    *string_key;
+       zstr                     string_key;
        ulong                    num_key;
        zend_bool                invert = 0;            /* Whether to return non-matching
                                                                                   entries */
@@ -1602,8 +1602,8 @@ PHP_FUNCTION(preg_grep)
                        switch(zend_hash_get_current_key(Z_ARRVAL_PP(input), &string_key, &num_key, 0))
                        {
                                case HASH_KEY_IS_STRING:
-                                       zend_hash_update(Z_ARRVAL_P(return_value), string_key,
-                                                                        strlen(string_key)+1, entry, sizeof(zval *), NULL);
+                                       zend_hash_update(Z_ARRVAL_P(return_value), string_key.s,
+                                                                        strlen(string_key.s)+1, entry, sizeof(zval *), NULL);
                                        break;
 
                                case HASH_KEY_IS_LONG:
index c72b6218de3fb654808647f09eefd12467bb178b..5b2c2529df5fd2ef67a930334f270e0d39d5bd64 100755 (executable)
@@ -1115,7 +1115,7 @@ int pdo_hash_methods(pdo_dbh_t *dbh, int kind TSRMLS_DC)
        while (funcs->fname) {
                ifunc->type = ZEND_INTERNAL_FUNCTION;
                ifunc->handler = funcs->handler;
-               ifunc->function_name = funcs->fname;
+               ifunc->function_name.s = funcs->fname;
                ifunc->scope = dbh->ce;
                ifunc->prototype = NULL;
                if (funcs->arg_info) {
@@ -1157,10 +1157,10 @@ static union _zend_function *dbh_method_get(
 #else
        zval *object,
 #endif
-       char *method_name, int method_len TSRMLS_DC)
+       zstr method_name, int method_len TSRMLS_DC)
 {
        zend_function *fbc = NULL;
-       char *lc_method_name;
+       zstr lc_method_name;
 #if PHP_API_VERSION >= 20041225
        zval *object = *object_pp;
 #endif
@@ -1191,7 +1191,7 @@ static union _zend_function *dbh_method_get(
        }
        
 out:
-       efree(lc_method_name);
+       efree(lc_method_name.v);
        return fbc;
 }
 
index 8c590ccc1924e2e223bf21b933d80d00775de1f9..0b00b43885bb3301bf3adde1acd5d7d5795d9354 100755 (executable)
@@ -356,11 +356,14 @@ static PHP_METHOD(PDOStatement, execute)
 
                zend_hash_internal_pointer_reset(Z_ARRVAL_P(input_params));
                while (SUCCESS == zend_hash_get_current_data(Z_ARRVAL_P(input_params), (void*)&tmp)) {
+                       zstr tmp_str;
+
                        memset(&param, 0, sizeof(param));
 
                        if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(Z_ARRVAL_P(input_params),
-                                               &param.name, &str_length, &num_index, 0, NULL)) {
+                                               &tmp_str, &str_length, &num_index, 0, NULL)) {
                                /* yes this is correct.  we don't want to count the null byte.  ask wez */
+                               param.name = tmp_str.s;
                                param.namelen = str_length - 1;
                                param.paramno = -1;
                        } else {
@@ -646,7 +649,7 @@ static int make_callable_ex(pdo_stmt_t *stmt, zval *callable, zend_fcall_info *
        zval **object = NULL, **method;
        zend_class_entry * ce = NULL, **pce;
        zend_function *function_handler;
-       char *lcname;
+       zstr lcname;
        unsigned int lcname_len;
        
        if (Z_TYPE_P(callable) == IS_ARRAY) {
@@ -689,11 +692,11 @@ static int make_callable_ex(pdo_stmt_t *stmt, zval *callable, zend_fcall_info *
 
        fci->function_table = ce ? &ce->function_table : EG(function_table);
        if (zend_u_hash_find(fci->function_table, Z_TYPE_PP(method), lcname, lcname_len+1, (void **)&function_handler) == FAILURE) {
-               efree(lcname);
+               efree(lcname.v);
                pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "user-supplied function does not exist" TSRMLS_CC);
                return 0;
        }
-       efree(lcname);
+       efree(lcname.v);
 
        fci->size = sizeof(zend_fcall_info);
        fci->function_name = NULL;
@@ -1293,7 +1296,7 @@ static PHP_METHOD(PDOStatement, fetchAll)
                                error = 1;
                                break;
                        } else {
-                               stmt->fetch.cls.ce = zend_u_fetch_class(Z_TYPE_P(arg2), Z_STRVAL_P(arg2), Z_STRLEN_P(arg2), ZEND_FETCH_CLASS_AUTO TSRMLS_CC);
+                               stmt->fetch.cls.ce = zend_u_fetch_class(Z_TYPE_P(arg2), Z_UNIVAL_P(arg2), Z_UNILEN_P(arg2), ZEND_FETCH_CLASS_AUTO TSRMLS_CC);
                                if (!stmt->fetch.cls.ce) {
                                        pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "could not find user-specified class" TSRMLS_CC);
                                        error = 1;
@@ -1868,7 +1871,7 @@ static PHP_METHOD(PDOStatement, debugDumpParams)
                zend_hash_internal_pointer_reset_ex(stmt->bound_params, &pos);
                while (SUCCESS == zend_hash_get_current_data_ex(stmt->bound_params,
                                (void**)&param, &pos)) {
-                       char *str;
+                       zstr str;
                        uint len;
                        ulong num;
 
@@ -1964,10 +1967,10 @@ static union _zend_function *dbstmt_method_get(
 #else
        zval *object,
 #endif
-       char *method_name, int method_len TSRMLS_DC)
+       zstr method_name, int method_len TSRMLS_DC)
 {
        zend_function *fbc = NULL;
-       char *lc_method_name;
+       zstr lc_method_name;
 #if PHP_API_VERSION >= 20041225
        zval *object = *object_pp;
 #endif
@@ -1999,7 +2002,7 @@ static union _zend_function *dbstmt_method_get(
        }
        
 out:
-       efree(lc_method_name);
+       efree(lc_method_name.v);
        return fbc;
 }
 
@@ -2190,7 +2193,7 @@ static void pdo_stmt_iter_get_data(zend_object_iterator *iter, zval ***data TSRM
        *data = &I->fetch_ahead;
 }
 
-static int pdo_stmt_iter_get_key(zend_object_iterator *iter, char **str_key, uint *str_key_len,
+static int pdo_stmt_iter_get_key(zend_object_iterator *iter, zstr *str_key, uint *str_key_len,
        ulong *int_key TSRMLS_DC)
 {
        struct php_pdo_iterator *I = (struct php_pdo_iterator*)iter->data;
@@ -2366,24 +2369,23 @@ static union _zend_function *row_method_get(
 #else
        zval *object,
 #endif
-       char *method_name, int method_len TSRMLS_DC)
+       zstr method_name, int method_len TSRMLS_DC)
 {
        zend_function *fbc;
-       char *lc_method_name;
+       zstr lc_method_name;
 
-       lc_method_name = emalloc(method_len + 1);
-       zend_str_tolower_copy(lc_method_name, method_name, method_len);
+       lc_method_name = zend_u_str_tolower_dup(UG(unicode)?IS_UNICODE:IS_STRING, method_name, method_len);
 
-       if (zend_hash_find(&pdo_row_ce->function_table, lc_method_name, method_len+1, (void**)&fbc) == FAILURE) {
-               efree(lc_method_name);
+       if (zend_u_hash_find(&pdo_row_ce->function_table, UG(unicode)?IS_UNICODE:IS_STRING, lc_method_name, method_len+1, (void**)&fbc) == FAILURE) {
+               efree(lc_method_name.v);
                return NULL;
        }
        
-       efree(lc_method_name);
+       efree(lc_method_name.v);
        return fbc;
 }
 
-static int row_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS)
+static int row_call_method(zstr method, INTERNAL_FUNCTION_PARAMETERS)
 {
        return FAILURE;
 }
@@ -2393,7 +2395,7 @@ static union _zend_function *row_get_ctor(zval *object TSRMLS_DC)
        static zend_internal_function ctor = {0};
 
        ctor.type = ZEND_INTERNAL_FUNCTION;
-       ctor.function_name = "__construct";
+       ctor.function_name.s = "__construct";
        ctor.scope = pdo_row_ce;
        ctor.handler = ZEND_FN(dbstmt_constructor);
 
@@ -2405,9 +2407,9 @@ static zend_class_entry *row_get_ce(zval *object TSRMLS_DC)
        return pdo_dbstmt_ce;
 }
 
-static int row_get_classname(zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC)
+static int row_get_classname(zval *object, zstr *class_name, zend_uint *class_name_len, int parent TSRMLS_DC)
 {
-       *class_name = estrndup("PDORow", sizeof("PDORow")-1);
+       class_name->s = estrndup("PDORow", sizeof("PDORow")-1);
        *class_name_len = sizeof("PDORow")-1;
        return 0;
 }
index 36b58de1333e962405fa3e2de6a6901399c30412..7fb8cf8cb18c1ab84329369e93af86ca5fdfe6fb 100644 (file)
@@ -353,7 +353,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
                if (count > 0) {
                        HashPosition pos;
                        zval **value;
-                       char *key;
+                       zstr key;
                        uint key_len;
                        ulong num_index;
 
@@ -362,7 +362,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
                        while (zend_hash_get_current_data_ex(&ce->constants_table, (void **) &value, &pos) == SUCCESS) {
                                zend_hash_get_current_key_ex(&ce->constants_table, &key, &key_len, &num_index, 0, &pos);
 
-                               _const_string(str, key, *value, indent TSRMLS_CC);
+                               _const_string(str, key.s, *value, indent TSRMLS_CC);
                                zend_hash_move_forward_ex(&ce->constants_table, &pos);
                        }
                }
@@ -479,18 +479,18 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
                zend_hash_internal_pointer_reset_ex(properties, &pos);
 
                while (zend_hash_get_current_data_ex(properties, (void **) &prop, &pos) == SUCCESS) {
-                       char  *prop_name;
+                       zstr prop_name;
                        uint  prop_name_size;
                        ulong index;
 
                        if (zend_hash_get_current_key_ex(properties, &prop_name, &prop_name_size, &index, 1, &pos) == HASH_KEY_IS_STRING) {
-                               if (prop_name_size && prop_name[0]) { /* skip all private and protected properties */
-                                       if (!zend_hash_quick_exists(&ce->properties_info, prop_name, prop_name_size, zend_get_hash_value(prop_name, prop_name_size))) {
+                               if (prop_name_size && prop_name.s[0]) { /* skip all private and protected properties */
+                                       if (!zend_hash_quick_exists(&ce->properties_info, prop_name.s, prop_name_size, zend_get_hash_value(prop_name.s, prop_name_size))) {
                                                count++;
-                                               _property_string(&dyn, NULL, prop_name, sub_indent.string TSRMLS_CC);   
+                                               _property_string(&dyn, NULL, prop_name.s, sub_indent.string TSRMLS_CC); 
                                        }
                                }
-                               efree(prop_name);
+                               efree(prop_name.s);
                        }
                        zend_hash_move_forward_ex(properties, &pos);
                }
@@ -566,7 +566,7 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg
        } else {
                string_printf(str, "<required> ");
        }
-       if (arg_info->class_name) {
+       if (arg_info->class_name.v) {
                string_printf(str, "%v ", arg_info->class_name);
                if (arg_info->allow_null) {
                        string_printf(str, "or NULL ");
@@ -580,7 +580,7 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg
        if (arg_info->pass_by_reference) {
                string_write(str, "&", sizeof("&")-1);
        }
-       if (arg_info->name) {
+       if (arg_info->name.v) {
                string_printf(str, "$%v", arg_info->name);
        } else {
                string_printf(str, "$param%d", offset);
@@ -666,7 +666,7 @@ static void _function_string(string *str, zend_function *fptr, zend_class_entry
 {
        string param_indent;
        zend_function *overwrites;
-       char *lc_name;
+       zstr lc_name;
        unsigned int lc_name_len;
 
        /* TBD: Repair indenting of doc comment (or is this to be done in the parser?)
@@ -686,13 +686,14 @@ static void _function_string(string *str, zend_function *fptr, zend_class_entry
                if (fptr->common.scope != scope) {
                        string_printf(str, ", inherits %v", fptr->common.scope->name);
                } else if (fptr->common.scope->parent) {
-                       lc_name = zend_u_str_case_fold(IS_STRING, fptr->common.function_name, strlen(fptr->common.function_name), 1, &lc_name_len);
+                       /* FIXME: Unicode support??? */
+                       lc_name = zend_u_str_case_fold(IS_STRING, fptr->common.function_name, strlen(fptr->common.function_name.s), 1, &lc_name_len);
                        if (zend_u_hash_find(&fptr->common.scope->parent->function_table, IS_STRING, lc_name, lc_name_len + 1, (void**) &overwrites) == SUCCESS) {
                                if (fptr->common.scope != overwrites->common.scope) {
                                        string_printf(str, ", overwrites %v", overwrites->common.scope->name);
                                }
                        }
-                       efree(lc_name);
+                       efree(lc_name.v);
                }
        }
        if (fptr->common.prototype && fptr->common.prototype->common.scope) {
@@ -755,7 +756,7 @@ static void _function_string(string *str, zend_function *fptr, zend_class_entry
 /* {{{ _property_string */
 static void _property_string(string *str, zend_property_info *prop, char *prop_name, char* indent TSRMLS_DC)
 {
-       char *class_name;
+       zstr class_name;
 
        string_printf(str, "%sProperty [ ", indent);
        if (!prop) {
@@ -853,7 +854,8 @@ static int _extension_const_string(zend_constant *constant, int num_args, va_lis
 
        if (constant->module_number  == module->module_number) {
                TSRMLS_FETCH();
-               _const_string(str, constant->name, &constant->value, indent TSRMLS_CC);
+               /* FIXME: Unicode support??? */
+               _const_string(str, constant->name.s, &constant->value, indent TSRMLS_CC);
                (*num_classes)++;
        }
        return ZEND_HASH_APPLY_KEEP;
@@ -1040,7 +1042,7 @@ static void reflection_parameter_factory(zend_function *fptr, struct _zend_arg_i
        zval *name;
 
        MAKE_STD_ZVAL(name);
-       if (arg_info->name) {
+       if (arg_info->name.v) {
                ZVAL_TEXTL(name, arg_info->name, arg_info->name_len, 1);
        } else {
                ZVAL_NULL(name);
@@ -1105,7 +1107,7 @@ static void reflection_property_factory(zend_class_entry *ce, zend_property_info
        zval *name;
        zval *classname;
        property_reference *reference;
-       char *class_name, *prop_name;
+       zstr class_name, prop_name;
        zend_uchar utype = UG(unicode) ? IS_UNICODE : IS_STRING;
 
        zend_u_unmangle_property_name(utype, prop->name, &class_name, &prop_name);
@@ -1114,7 +1116,7 @@ static void reflection_property_factory(zend_class_entry *ce, zend_property_info
                /* we have to seach the class hierarchy for this (implicit) public or protected property */
                zend_class_entry *tmp_ce = ce;
                zend_property_info *tmp_info;
-               int prop_name_len = UG(unicode) ? u_strlen((UChar*)prop_name) : strlen(prop_name);
+               int prop_name_len = UG(unicode) ? u_strlen(prop_name.u) : strlen(prop_name.s);
                
                while (tmp_ce && zend_u_hash_find(&tmp_ce->properties_info, utype, prop_name, prop_name_len + 1, (void **) &tmp_info) != SUCCESS) {
                        ce = tmp_ce;
@@ -1338,10 +1340,10 @@ ZEND_METHOD(reflection_function, __construct)
        zval *name;
        zval *object;
        unsigned int lcname_len;
-       char *lcname;
+       zstr lcname;
        reflection_object *intern;
        zend_function *fptr;
-       char *name_str;
+       zstr name_str;
        int name_len;
        zend_uchar type;
 
@@ -1356,12 +1358,12 @@ ZEND_METHOD(reflection_function, __construct)
        }
        lcname = zend_u_str_case_fold(type, name_str, name_len, 1, &lcname_len);
        if (zend_u_hash_find(EG(function_table), type, lcname, lcname_len + 1, (void **)&fptr) == FAILURE) {
-               efree(lcname);
+               efree(lcname.v);
                zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                        "Function %R() does not exist", type, name_str);
                return;
        }
-       efree(lcname);
+       efree(lcname.v);
        MAKE_STD_ZVAL(name);
        ZVAL_TEXT(name, fptr->common.function_name, 1);
        zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &name, sizeof(zval *), NULL);
@@ -1777,17 +1779,17 @@ ZEND_METHOD(reflection_parameter, __construct)
                case IS_UNICODE:
                case IS_STRING: {
                                unsigned int lcname_len;
-                       char *lcname;
+                               zstr lcname;
 
                                convert_to_text_ex(&reference);
                                lcname = zend_u_str_case_fold(Z_TYPE_P(reference), Z_UNIVAL_P(reference), Z_UNILEN_P(reference), 1, &lcname_len);
                                if (zend_u_hash_find(EG(function_table), Z_TYPE_P(reference), lcname, lcname_len + 1, (void**) &fptr) == FAILURE) {
-                                       efree(lcname);
+                                       efree(lcname.v);
                                        zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                                                "Function %R() does not exist", Z_TYPE_P(reference), Z_UNIVAL_P(reference));
                                        return;
                                }
-                               efree(lcname);
+                               efree(lcname.v);
                        }
                        break;
 
@@ -1796,7 +1798,7 @@ ZEND_METHOD(reflection_parameter, __construct)
                                zval **method;
                                zend_class_entry **pce;
                                unsigned int lcname_len;
-                               char *lcname;
+                               zstr lcname;
                                
                                if ((zend_hash_index_find(Z_ARRVAL_P(reference), 0, (void **) &classref) == FAILURE)
                                        || (zend_hash_index_find(Z_ARRVAL_P(reference), 1, (void **) &method) == FAILURE)) {
@@ -1819,12 +1821,12 @@ ZEND_METHOD(reflection_parameter, __construct)
                                convert_to_text_ex(method);
                                lcname = zend_u_str_case_fold(Z_TYPE_PP(method), Z_UNIVAL_PP(method), Z_UNILEN_PP(method), 1, &lcname_len);
                                if (zend_u_hash_find(&ce->function_table, Z_TYPE_PP(method), lcname, lcname_len + 1, (void **) &fptr) == FAILURE) {
-                                       efree(lcname);
+                                       efree(lcname.v);
                                        zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                                                "Method %R::%R() does not exist", Z_TYPE_PP(classref), Z_UNIVAL_PP(classref), Z_TYPE_PP(method), Z_UNIVAL_PP(method));
                                        return;
                                }
-                               efree(lcname);
+                               efree(lcname.v);
                        }
                        break;
                        
@@ -1847,7 +1849,8 @@ ZEND_METHOD(reflection_parameter, __construct)
                position= -1;
                convert_to_string_ex(&parameter);
                for (i = 0; i < fptr->common.num_args; i++) {
-                       if (arg_info[i].name && strcmp(arg_info[i].name, Z_STRVAL_P(parameter)) == 0) {
+                       /* FIXME: Unicode support??? */
+                       if (arg_info[i].name.s && strcmp(arg_info[i].name.s, Z_STRVAL_P(parameter)) == 0) {
                                position= i;
                                break;
                        }
@@ -1859,7 +1862,7 @@ ZEND_METHOD(reflection_parameter, __construct)
        }
        
        MAKE_STD_ZVAL(name);
-       if (arg_info[position].name) {
+       if (arg_info[position].name.v) {
                ZVAL_TEXTL(name, arg_info[position].name, arg_info[position].name_len, 1);
        } else {
                ZVAL_NULL(name);
@@ -1912,7 +1915,7 @@ ZEND_METHOD(reflection_parameter, getDeclaringClass)
        METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
        GET_REFLECTION_OBJECT_PTR(param);
 
-       if (!param->arg_info->class_name) {
+       if (!param->arg_info->class_name.v) {
                RETURN_NULL();
        } else {
                zend_class_entry **pce;
@@ -2059,11 +2062,12 @@ ZEND_METHOD(reflection_method, __construct)
        zval *object;
        reflection_object *intern;
        unsigned int lcname_len;
-       char *lcname;
+       zstr lcname;
        zend_class_entry **pce;
        zend_class_entry *ce;
        zend_function *mptr;
-       char *name_str, *tmp;
+       zstr name_str;
+       char *tmp;
        int name_len, tmp_len;
        zval ztmp;
        zend_uchar type;
@@ -2072,15 +2076,16 @@ ZEND_METHOD(reflection_method, __construct)
                if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name_str, &name_len) == FAILURE) {
                        return;
                }
-               if ((tmp = strstr(name_str, "::")) == NULL) {
+               /* FIXME: Unicode support??? */
+               if ((tmp = strstr(name_str.s, "::")) == NULL) {
                        return;
                }
                type = IS_STRING;
                classname = &ztmp;
-               tmp_len = tmp - name_str;
-               ZVAL_STRINGL(classname, name_str, tmp_len, 1);
+               tmp_len = tmp - name_str.s;
+               ZVAL_STRINGL(classname, name_str.s, tmp_len, 1);
                name_len = name_len - (tmp_len + 2);
-               name_str = tmp + 2;
+               name_str.s = tmp + 2;
        }
 
        object = getThis();
@@ -2122,12 +2127,12 @@ ZEND_METHOD(reflection_method, __construct)
        lcname = zend_u_str_case_fold(type, name_str, name_len, 1, &lcname_len);
 
        if (zend_u_hash_find(&ce->function_table, type, lcname, lcname_len + 1, (void **) &mptr) == FAILURE) {
-               efree(lcname);
+               efree(lcname.v);
                zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                        "Method %v::%R() does not exist", ce->name, type, name_str);
                return;
        }
-       efree(lcname);
+       efree(lcname.v);
 
        MAKE_STD_ZVAL(name);
        ZVAL_TEXT(name, mptr->common.function_name, 1);
@@ -2502,7 +2507,7 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob
        zval *classname;
        reflection_object *intern;
        zend_class_entry **ce;
-       char *name;
+       zstr name;
        int name_len;
        zend_uchar name_type;
 
@@ -2584,7 +2589,7 @@ ZEND_METHOD(reflection_class, getStaticPropertyValue)
 {
        reflection_object *intern;
        zend_class_entry *ce;
-       char *name;
+       zstr name;
        int name_len;
        zval **prop, *def_value = NULL;
        zend_uchar name_type;
@@ -2617,7 +2622,7 @@ ZEND_METHOD(reflection_class, setStaticPropertyValue)
 {
        reflection_object *intern;
        zend_class_entry *ce;
-       char *name;
+       zstr name;
        int name_len;
        zval **variable_ptr, *value;
        int refcount;
@@ -2669,15 +2674,16 @@ ZEND_METHOD(reflection_class, getDefaultProperties)
 
                zend_hash_internal_pointer_reset_ex(&ce->default_properties, &pos);
                while (zend_hash_get_current_data_ex(&ce->default_properties, (void **) &prop, &pos) == SUCCESS) {
-                       char *key, *class_name, *prop_name;
+                       zstr key, class_name, prop_name;
                        uint key_len;
                        ulong num_index;
                        zval *prop_copy;
 
                        zend_hash_get_current_key_ex(&ce->default_properties, &key, &key_len, &num_index, 0, &pos);
                        zend_hash_move_forward_ex(&ce->default_properties, &pos);
-                       zend_unmangle_property_name(key, &class_name, &prop_name);
-                       if (class_name && class_name[0] != '*' && strcmp(class_name, ce->name)) {
+                       zend_u_unmangle_property_name(UG(unicode)?IS_UNICODE:IS_STRING, key, &class_name, &prop_name);
+                       /* FIXME: Unicode support??? */
+                       if (class_name.s && class_name.s[0] != '*' && strcmp(class_name.s, ce->name.s)) {
                                /* filter privates from base classes */
                                continue;
                        }
@@ -2688,7 +2694,7 @@ ZEND_METHOD(reflection_class, getDefaultProperties)
                        zval_copy_ctor(prop_copy);
                        INIT_PZVAL(prop_copy);
 
-                       add_assoc_zval(return_value, prop_name, prop_copy);
+                       add_assoc_zval(return_value, prop_name.s, prop_copy);
                }
        }
 }
@@ -2834,7 +2840,7 @@ ZEND_METHOD(reflection_class, hasMethod)
        reflection_object *intern;
        zend_class_entry *ce;
        unsigned int lc_name_len;
-       char *name, *lc_name; 
+       zstr name, lc_name; 
        int name_len;
        zend_uchar type;
 
@@ -2846,10 +2852,10 @@ ZEND_METHOD(reflection_class, hasMethod)
        GET_REFLECTION_OBJECT_PTR(ce);
        lc_name = zend_u_str_case_fold(type, name, name_len, 1, &lc_name_len);
        if (zend_u_hash_exists(&ce->function_table, type, lc_name, lc_name_len + 1)) {
-               efree(lc_name);
+               efree(lc_name.v);
                RETURN_TRUE;
        } else {
-               efree(lc_name);
+               efree(lc_name.v);
                RETURN_FALSE;
        }
 }
@@ -2863,7 +2869,7 @@ ZEND_METHOD(reflection_class, getMethod)
        zend_class_entry *ce;
        zend_function *mptr;
        unsigned int lc_name_len;
-       char *name, *lc_name; 
+       zstr name, lc_name; 
        int name_len;
        zend_uchar type;
 
@@ -2876,9 +2882,9 @@ ZEND_METHOD(reflection_class, getMethod)
        lc_name = zend_u_str_case_fold(type, name, name_len, 1, &lc_name_len);
        if (zend_u_hash_find(&ce->function_table, type, lc_name, lc_name_len + 1, (void**) &mptr) == SUCCESS) {
                reflection_method_factory(ce, mptr, return_value TSRMLS_CC);
-               efree(lc_name);
+               efree(lc_name.v);
        } else {
-               efree(lc_name);
+               efree(lc_name.v);
                zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                                "Method %R does not exist", type, name);
                return;
@@ -2971,7 +2977,8 @@ ZEND_METHOD(reflection_class, getProperty)
        reflection_object *intern;
        zend_class_entry *ce, **pce;
        zend_property_info *property_info;
-       char *name, *tmp, *classname; 
+       zstr name, classname;
+       char *tmp; 
        int name_len, classname_len;
        zend_uchar name_type;
 
@@ -2985,21 +2992,22 @@ ZEND_METHOD(reflection_class, getProperty)
                reflection_property_factory(ce, property_info, return_value TSRMLS_CC);
                return;
        }
-       if ((tmp = strstr(name, "::")) != NULL) {
-               classname_len = tmp - name;
-               classname = zend_str_tolower_dup(name, classname_len);
-               classname[classname_len] = '\0';
+       /* FIXME: Unicode support??? */
+       if ((tmp = strstr(name.s, "::")) != NULL) {
+               classname_len = tmp - name.s;
+               classname.s = zend_str_tolower_dup(name.s, classname_len);
+               classname.s[classname_len] = '\0';
                name_len = name_len - (classname_len + 2);
-               name = tmp + 2;
+               name.s = tmp + 2;
 
                if (zend_u_lookup_class(name_type, classname, classname_len, &pce TSRMLS_CC) == FAILURE) {
                        if (!EG(exception)) {
                                zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Class %R does not exist", name_type, classname);
                        }
-                       efree(classname);
+                       efree(classname.v);
                        return;
                }
-               efree(classname);
+               efree(classname.v);
 
                if (!instanceof_function(ce, *pce TSRMLS_CC)) {
                        zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Fully qualified property name %v::%R does not specify a base class of %v", (*pce)->name, name_type, name, ce->name);
@@ -3372,7 +3380,8 @@ ZEND_METHOD(reflection_class, getInterfaces)
                        zval *interface;
                        ALLOC_ZVAL(interface);
                        zend_reflection_class_factory(ce->interfaces[i], interface TSRMLS_CC);
-                       add_assoc_zval_ex(return_value, ce->interfaces[i]->name, ce->interfaces[i]->name_length + 1, interface);
+                       /* FIXME: Unicode support??? */
+                       add_assoc_zval_ex(return_value, ce->interfaces[i]->name.s, ce->interfaces[i]->name_length + 1, interface);
                }
        }
 }
@@ -3571,7 +3580,7 @@ ZEND_METHOD(reflection_property, export)
 ZEND_METHOD(reflection_property, __construct)
 {
        zval *propname, *classname;
-       char *name_str, *class_name, *prop_name;
+       zstr name_str, class_name, prop_name;
        int name_len;
        zval *object;
        reflection_object *intern;
@@ -3888,9 +3897,9 @@ ZEND_METHOD(reflection_property, getDeclaringClass)
        GET_REFLECTION_OBJECT_PTR(ref);
 
        ce = tmp_ce = ref->ce;
-       while (tmp_ce && zend_hash_find(&tmp_ce->properties_info, ref->prop->name, ref->prop->name_length + 1, (void **) &tmp_info) == SUCCESS) {
+       while (tmp_ce && zend_u_hash_find(&tmp_ce->properties_info, UG(unicode)?IS_UNICODE:IS_STRING, ref->prop->name, ref->prop->name_length + 1, (void **) &tmp_info) == SUCCESS) {
                ce = tmp_ce;
-                tmp_ce = tmp_ce->parent;
+               tmp_ce = tmp_ce->parent;
        }
 
        zend_reflection_class_factory(ce, return_value TSRMLS_CC);
@@ -4045,7 +4054,8 @@ static int _addconstant(zend_constant *constant, int num_args, va_list args, zen
                *const_val = constant->value;
                zval_copy_ctor(const_val);
                INIT_PZVAL(const_val);
-               add_assoc_zval_ex(retval, constant->name, constant->name_len, const_val);
+               /* FIXME: Unicode support???*/
+               add_assoc_zval_ex(retval, constant->name.s, constant->name_len, const_val);
        }
        return 0;
 }
@@ -4109,9 +4119,11 @@ static int add_extension_class(zend_class_entry **pce, int num_args, va_list arg
                if (add_reflection_class) {
                        ALLOC_ZVAL(zclass);
                        zend_reflection_class_factory(*pce, zclass TSRMLS_CC);
-                       add_assoc_zval_ex(class_array, (*pce)->name, (*pce)->name_length + 1, zclass);
+                       /* FIXME: Unicode support??? */
+                       add_assoc_zval_ex(class_array, (*pce)->name.s, (*pce)->name_length + 1, zclass);
                } else {
-                       add_next_index_stringl(class_array, (*pce)->name, (*pce)->name_length, 1);
+                       /* FIXME: Unicode support??? */
+                       add_next_index_stringl(class_array, (*pce)->name.s, (*pce)->name_length, 1);
                }
        }
        return ZEND_HASH_APPLY_KEEP;
index bc3dbcbf7e53b4c9833591b9dd3b27bbd0e2aa1c..f2b70d4ed71bee8ac058d08e02513bfa04047181 100644 (file)
@@ -211,7 +211,7 @@ PHPAPI void php_session_start(TSRMLS_D);
 
 
 #define PS_ENCODE_VARS                                                                                         \
-       char *key;                                                                                                      \
+       zstr key;                                                                                                       \
        uint key_length;                                                                                        \
        ulong num_key;                                                                                          \
        zval **struc;
@@ -223,7 +223,7 @@ PHPAPI void php_session_start(TSRMLS_D);
                                zend_hash_get_current_key_ex(_ht, &key, &key_length, &num_key, 0, NULL) == HASH_KEY_IS_STRING; \
                                zend_hash_move_forward(_ht)) {                          \
                                key_length--;                                                                           \
-                       if (php_get_session_var(key, key_length, &struc TSRMLS_CC) == SUCCESS) { \
+                       if (php_get_session_var(key.s, key_length, &struc TSRMLS_CC) == SUCCESS) { \
                                code;                                                                                           \
                        }                                                                                                               \
                }                                                                                                                       \
index 04402cbb16b9966872ee65919ff765b1846a3223..0e8f7a3ed1fbeb3466cf6e9efcd07bca4ac6a39a 100644 (file)
@@ -401,13 +401,13 @@ PS_SERIALIZER_ENCODE_FUNC(php_binary)
        PS_ENCODE_LOOP(
                        if (key_length > PS_BIN_MAX) continue;
                        smart_str_appendc(&buf, (unsigned char) key_length);
-                       smart_str_appendl(&buf, key, key_length);
+                       smart_str_appendl(&buf, key.s, key_length);
                        
                        php_var_serialize(&buf, struc, &var_hash TSRMLS_CC);
                } else {
                        if (key_length > PS_BIN_MAX) continue;
                        smart_str_appendc(&buf, (unsigned char) (key_length & PS_BIN_UNDEF));
-                       smart_str_appendl(&buf, key, key_length);
+                       smart_str_appendl(&buf, key.s, key_length);
        );
        
        if (newlen) *newlen = buf.len;
@@ -465,8 +465,8 @@ PS_SERIALIZER_ENCODE_FUNC(php)
        PHP_VAR_SERIALIZE_INIT(var_hash);
 
        PS_ENCODE_LOOP(
-                       smart_str_appendl(&buf, key, (unsigned char) key_length);
-                       if (memchr(key, PS_DELIMITER, key_length)) {
+                       smart_str_appendl(&buf, key.s, (unsigned char) key_length);
+                       if (memchr(key.s, PS_DELIMITER, key_length)) {
                                PHP_VAR_SERIALIZE_DESTROY(var_hash);
                                smart_str_free(&buf);                           
                                return FAILURE;
@@ -476,7 +476,7 @@ PS_SERIALIZER_ENCODE_FUNC(php)
                        php_var_serialize(&buf, struc, &var_hash TSRMLS_CC);
                } else {
                        smart_str_appendc(&buf, PS_UNDEF_MARKER);
-                       smart_str_appendl(&buf, key, key_length);
+                       smart_str_appendl(&buf, key.s, key_length);
                        smart_str_appendc(&buf, PS_DELIMITER);
        );
        
@@ -775,7 +775,7 @@ static void php_session_initialize(TSRMLS_D)
 
 static int migrate_global(HashTable *ht, HashPosition *pos TSRMLS_DC)
 {
-       char *str;
+       zstr str;
        uint str_len;
        ulong num_key;
        int n;
@@ -786,10 +786,12 @@ static int migrate_global(HashTable *ht, HashPosition *pos TSRMLS_DC)
 
        switch (n) {
                case HASH_KEY_IS_STRING:
-                       if (zend_hash_find(&EG(symbol_table), str, str_len, 
+               case HASH_KEY_IS_UNICODE:
+                       if (zend_u_hash_find(&EG(symbol_table), n, str, str_len, 
                                                (void **) &val) == SUCCESS 
                                        && val && Z_TYPE_PP(val) != IS_NULL) {
-                               ZEND_SET_SYMBOL_WITH_LENGTH(ht, str, str_len, *val, 
+                               /* FIXME: Unicode support??? */
+                               ZEND_SET_SYMBOL_WITH_LENGTH(ht, str.s, str_len, *val, 
                                                (*val)->refcount + 1 , 1);
                                ret = 1;
                        }
@@ -1725,7 +1727,7 @@ PHP_FUNCTION(session_unset)
 
                if (PG(register_globals)) {
                        uint str_len;
-                       char *str;
+                       zstr str;
                        ulong num_key;
                        HashPosition pos;
                        
@@ -1733,7 +1735,7 @@ PHP_FUNCTION(session_unset)
 
                        while (zend_hash_get_current_key_ex(ht, &str, &str_len, &num_key, 
                                                0, &pos) == HASH_KEY_IS_STRING) {
-                               zend_delete_global_variable(str, str_len-1 TSRMLS_CC);
+                               zend_delete_global_variable(str.s, str_len-1 TSRMLS_CC);
                                zend_hash_move_forward_ex(ht, &pos);
                        }
                }
index 487c7d0d8f27736799d74d431ffd1d5bb913919f..5c2ac62dcd532e5c4fc850869cf51829185d59eb 100644 (file)
@@ -1701,7 +1701,7 @@ SXE_METHOD(__construct)
 static void php_sxe_iterator_dtor(zend_object_iterator *iter TSRMLS_DC);
 static int php_sxe_iterator_valid(zend_object_iterator *iter TSRMLS_DC);
 static void php_sxe_iterator_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC);
-static int php_sxe_iterator_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC);
+static int php_sxe_iterator_current_key(zend_object_iterator *iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC);
 static void php_sxe_iterator_move_forward(zend_object_iterator *iter TSRMLS_DC);
 static void php_sxe_iterator_rewind(zend_object_iterator *iter TSRMLS_DC);
 
@@ -1812,7 +1812,7 @@ static void php_sxe_iterator_current_data(zend_object_iterator *iter, zval ***da
        *data = &iterator->sxe->iter.data;
 }
 
-static int php_sxe_iterator_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)
+static int php_sxe_iterator_current_key(zend_object_iterator *iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)
 {
        zval *curobj;
        xmlNodePtr curnode = NULL;
@@ -1832,12 +1832,12 @@ static int php_sxe_iterator_current_key(zend_object_iterator *iter, char **str_k
                int32_t u_len;
 
                namelen = xmlStrlen(curnode->name);
-               zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), (UChar**)str_key, &u_len, (char*)curnode->name, namelen, &status);
+               zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &str_key->u, &u_len, (char*)curnode->name, namelen, &status);
                *str_key_len = u_len + 1;
                return HASH_KEY_IS_UNICODE;
        } else {
                namelen = xmlStrlen(curnode->name);
-               *str_key = estrndup(curnode->name, namelen);
+               str_key->s = estrndup(curnode->name, namelen);
                *str_key_len = namelen + 1;
                return HASH_KEY_IS_STRING;
        }
index 296fd6e07358353ba8745d2b439ffe95ea23435d..011f63fca285e92930947721c0bf415945c27de3 100644 (file)
@@ -321,7 +321,8 @@ xmlNodePtr master_to_xml(encodePtr encode, zval *data, int style, xmlNodePtr par
                             zend_hash_move_forward_ex(SOAP_GLOBAL(class_map), &pos)) {
                                if (Z_TYPE_PP(tmp) == IS_STRING &&
                                    ce->name_length == Z_STRLEN_PP(tmp) &&
-                                   zend_binary_strncasecmp(ce->name, ce->name_length, Z_STRVAL_PP(tmp), ce->name_length, ce->name_length) == 0 &&
+                                   /* FIXME: Unicode support??? */
+                                   zend_binary_strncasecmp(ce->name.s, ce->name_length, Z_STRVAL_PP(tmp), ce->name_length, ce->name_length) == 0 &&
                                    zend_hash_get_current_key_ex(SOAP_GLOBAL(class_map), &type_name, &type_len, &idx, 0, &pos) == HASH_KEY_IS_STRING) {
 
                                    /* TODO: namespace isn't stored */
@@ -1025,7 +1026,8 @@ static zval* get_zval_property(zval* object, char* name TSRMLS_DC)
 
                        property_info = zend_get_property_info(Z_OBJCE_P(object), &member, 1 TSRMLS_CC);
                        EG(scope) = old_scope;
-                       if (property_info && zend_hash_quick_exists(Z_OBJPROP_P(object), property_info->name, property_info->name_length+1, property_info->h)) {
+                       /* FIXME: Unicode support??? */
+                       if (property_info && zend_hash_quick_exists(Z_OBJPROP_P(object), property_info->name.s, property_info->name_length+1, property_info->h)) {
                                return data;
                        }
                        return NULL;
index f0aa4cde56a9109b37f82a9ae8bf4c610233e3ad..d9bbf21d84837d29b453a05eadf5d05229ae160e 100644 (file)
@@ -509,7 +509,7 @@ PHP_MINIT_FUNCTION(soap)
 
                fe.type = ZEND_INTERNAL_FUNCTION;
                fe.handler = ZEND_FN(SoapClient___call);
-               fe.function_name = NULL;
+               fe.function_name.v = NULL;
                fe.scope = NULL;
                fe.fn_flags = 0;
                fe.prototype = NULL;
@@ -1243,7 +1243,8 @@ PHP_METHOD(SoapServer, getFunctions)
                zend_hash_internal_pointer_reset_ex(ft, &pos);
                while (zend_hash_get_current_data_ex(ft, (void **)&f, &pos) != FAILURE) {
                        if ((service->type != SOAP_CLASS) || (f->common.fn_flags & ZEND_ACC_PUBLIC)) {
-                               add_next_index_string(return_value, f->common.function_name, 1);
+                               /* FIXME: Unicode support??? */
+                               add_next_index_string(return_value, f->common.function_name.s, 1);
                        }
                        zend_hash_move_forward_ex(ft, &pos);
                }
@@ -1301,7 +1302,7 @@ PHP_METHOD(SoapServer, addFunction)
                                }
 
                                MAKE_STD_ZVAL(function_copy);
-                               ZVAL_STRING(function_copy, f->common.function_name, 1);
+                               ZVAL_TEXT(function_copy, f->common.function_name, 1);
                                zend_hash_update(service->soap_functions.ft, key, key_len+1, &function_copy, sizeof(zval *), NULL);
 
                                efree(key);
@@ -1327,7 +1328,7 @@ PHP_METHOD(SoapServer, addFunction)
                }
 
                MAKE_STD_ZVAL(function_copy);
-               ZVAL_STRING(function_copy, f->common.function_name, 1);
+               ZVAL_TEXT(function_copy, f->common.function_name, 1);
                zend_hash_update(service->soap_functions.ft, key, key_len+1, &function_copy, sizeof(zval *), NULL);
                efree(key);
        } else if (function_name->type == IS_LONG) {
@@ -1576,17 +1577,18 @@ PHP_METHOD(SoapServer, handle)
 #else
       {
 #endif
-                               int class_name_len = strlen(service->soap_class.ce->name);
+                               /* FIXME: Unicode support??? */
+                               int class_name_len = strlen(service->soap_class.ce->name.s);
                                char *class_name = emalloc(class_name_len+1);
 
-                               memcpy(class_name, service->soap_class.ce->name,class_name_len+1);
+                               memcpy(class_name, service->soap_class.ce->name.s, class_name_len+1);
                                if (zend_hash_exists(&Z_OBJCE_P(tmp_soap)->function_table, php_strtolower(class_name, class_name_len), class_name_len+1)) {
                                        zval c_ret, constructor;
 
                                        INIT_ZVAL(c_ret);
                                        INIT_ZVAL(constructor);
 
-                                       ZVAL_STRING(&constructor, service->soap_class.ce->name, 1);
+                                       ZVAL_TEXT(&constructor, service->soap_class.ce->name, 1);
                                        if (call_user_function(NULL, &tmp_soap, &constructor, &c_ret, service->soap_class.argc, service->soap_class.argv TSRMLS_CC) == FAILURE) {
                                                php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error calling constructor");
                                        }
index f4d7afd12482a3d3d6c4950542624895cf7d5f2d..fda18459f94521c5ecb797355dae72a2d680ec3e 100755 (executable)
@@ -59,17 +59,17 @@ static void spl_init_globals(zend_spl_globals *spl_globals)
 }
 /* }}} */
 
-static zend_class_entry * spl_find_ce_by_name(zend_uchar ztype, void *name, int len, zend_bool autoload TSRMLS_DC)
+static zend_class_entry * spl_find_ce_by_name(zend_uchar ztype, zstr name, int len, zend_bool autoload TSRMLS_DC)
 {
        zend_class_entry **ce;
        int found;
 
        if (!autoload) {
-               char *lc_name;
+               zstr lc_name;
 
                lc_name = zend_u_str_tolower_dup(ztype, name, len);
                found = zend_u_hash_find(EG(class_table), ztype, lc_name, len +1, (void **) &ce);
-               efree(lc_name);
+               efree(lc_name.v);
        } else {
                found = zend_u_lookup_class(ztype, name, len, &ce TSRMLS_CC);
        }
@@ -342,7 +342,7 @@ PHP_FUNCTION(spl_autoload_call)
 {
        zval *class_name, *retval = NULL;
        int class_name_len, class_name_type;
-       char *func_name, *lc_name;
+       zstr func_name, lc_name;
        uint func_name_len;
        ulong dummy;
        HashPosition function_pos;
@@ -361,7 +361,8 @@ PHP_FUNCTION(spl_autoload_call)
                while(zend_hash_has_more_elements_ex(SPL_G(autoload_functions), &function_pos) == SUCCESS && !EG(exception)) {
                        zend_hash_get_current_key_ex(SPL_G(autoload_functions), &func_name, &func_name_len, &dummy, 0, &function_pos);
                        zend_hash_get_current_data_ex(SPL_G(autoload_functions), (void **) &alfi, &function_pos);
-                       zend_call_method(alfi->obj ? &alfi->obj : NULL, alfi->ce, &alfi->func_ptr, func_name, func_name_len, &retval, 1, class_name, NULL TSRMLS_CC);
+                       /* TODO: Unicode support??? */
+                       zend_call_method(alfi->obj ? &alfi->obj : NULL, alfi->ce, &alfi->func_ptr, func_name.s, func_name_len, &retval, 1, class_name, NULL TSRMLS_CC);
                        if (retval) {
                                zval_ptr_dtor(&retval);                                 
                        }
@@ -370,7 +371,7 @@ PHP_FUNCTION(spl_autoload_call)
                        }
                        zend_hash_move_forward_ex(SPL_G(autoload_functions), &function_pos);
                }
-               efree(lc_name);
+               efree(lc_name.v);
        } else {
                /* do not use or overwrite &EG(autoload_func) here */
                zend_call_method_with_1_params(NULL, NULL, NULL, "spl_autoload", NULL, class_name);
@@ -485,7 +486,7 @@ PHP_FUNCTION(spl_autoload_register)
  Unregister given function as __autoload() implementation */
 PHP_FUNCTION(spl_autoload_unregister)
 {
-       char *func_name, *lc_name;
+       zstr func_name, lc_name;
        int func_name_len, success = FAILURE;
        zend_function *spl_func_ptr;
        zend_uchar func_name_type;
@@ -520,7 +521,7 @@ PHP_FUNCTION(spl_autoload_unregister)
                }
        }
 
-       efree(lc_name);
+       efree(lc_name.v);
        
        RETURN_BOOL(success == SUCCESS);
 } /* }}} */
index 34d00328dd128698c19930db1e5e85e0fbcd59e2..f1e30b9c940dc196753bd73bec3f89a5274fa784 100755 (executable)
@@ -331,7 +331,8 @@ static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval
        switch(Z_TYPE_P(offset)) {
        case IS_STRING:
        case IS_UNICODE:
-               if (*(char*)Z_UNIVAL_P(offset) == '\0') {
+               /* FIXME: Unicode support??? */
+               if (Z_STRVAL_P(offset)[0] == '\0') {
                        zend_throw_exception(spl_ce_InvalidArgumentException, "An offset must not begin with \\0 or be empty", 0 TSRMLS_CC);
                        return;
                }
@@ -621,7 +622,7 @@ static void spl_array_unset_property(zval *object, zval *member TSRMLS_DC) /* {{
 
 static int spl_array_skip_protected(spl_array_object *intern TSRMLS_DC) /* {{{ */
 {
-       char *string_key;
+       zstr string_key;
        uint string_length;
        ulong num_key;
        HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
@@ -630,8 +631,8 @@ static int spl_array_skip_protected(spl_array_object *intern TSRMLS_DC) /* {{{ *
                do {
                        if (zend_hash_get_current_key_ex(aht, &string_key, &string_length, &num_key, 0, &intern->pos) == (UG(unicode)?HASH_KEY_IS_UNICODE:HASH_KEY_IS_STRING)) {
                                if (!string_length || 
-                                   ((UG(unicode) && ((UChar*)string_key)[0]) ||
-                                    (!UG(unicode) && string_key[0]))) {
+                                   ((UG(unicode) && string_key.u[0]) ||
+                                    (!UG(unicode) && string_key.s[0]))) {
                                        return SUCCESS;
                                }
                        } else {
@@ -721,7 +722,7 @@ static void spl_array_it_get_current_data(zend_object_iterator *iter, zval ***da
 }
 /* }}} */
 
-static int spl_array_it_get_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) /* {{{ */
+static int spl_array_it_get_current_key(zend_object_iterator *iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) /* {{{ */
 {
        spl_array_it       *iterator = (spl_array_it *)iter;
        spl_array_object   *object   = iterator->object;
@@ -1208,7 +1209,7 @@ SPL_METHOD(Array, key)
 void spl_array_iterator_key(zval *object, zval *return_value TSRMLS_DC) /* {{{ */
 {
        spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
-       char *string_key;
+       zstr string_key;
        uint string_length;
        ulong num_key;
        HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
@@ -1225,10 +1226,10 @@ void spl_array_iterator_key(zval *object, zval *return_value TSRMLS_DC) /* {{{ *
 
        switch (zend_hash_get_current_key_ex(aht, &string_key, &string_length, &num_key, 1, &intern->pos)) {
                case HASH_KEY_IS_STRING:
-                       RETVAL_STRINGL(string_key, string_length - 1, 0);
+                       RETVAL_STRINGL(string_key.s, string_length - 1, 0);
                        break;
                case HASH_KEY_IS_UNICODE:
-                       RETVAL_UNICODEL((UChar*)string_key, string_length - 1, 0);
+                       RETVAL_UNICODEL(string_key.u, string_length - 1, 0);
                        break;
                case HASH_KEY_IS_LONG:
                        RETVAL_LONG(num_key);
index a5d093bf15a9edd2eafda3c97591a69446a19c1e..ad3806d91ee34919e0c86d2e60aa0fabe6457894 100755 (executable)
@@ -948,7 +948,7 @@ typedef struct {
 static void spl_filesystem_dir_it_dtor(zend_object_iterator *iter TSRMLS_DC);
 static int spl_filesystem_dir_it_valid(zend_object_iterator *iter TSRMLS_DC);
 static void spl_filesystem_dir_it_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC);
-static int spl_filesystem_dir_it_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC);
+static int spl_filesystem_dir_it_current_key(zend_object_iterator *iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC);
 static void spl_filesystem_dir_it_move_forward(zend_object_iterator *iter TSRMLS_DC);
 static void spl_filesystem_dir_it_rewind(zend_object_iterator *iter TSRMLS_DC);
 
@@ -1017,7 +1017,7 @@ static void spl_filesystem_dir_it_current_data(zend_object_iterator *iter, zval
 /* }}} */
 
 /* {{{ spl_filesystem_dir_it_current_key */
-static int spl_filesystem_dir_it_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)
+static int spl_filesystem_dir_it_current_key(zend_object_iterator *iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)
 {
        spl_filesystem_dir_it *iterator = (spl_filesystem_dir_it *)iter;
        spl_filesystem_object *object   = iterator->object;
@@ -1101,18 +1101,18 @@ static void spl_filesystem_tree_it_current_data(zend_object_iterator *iter, zval
 /* }}} */
 
 /* {{{ spl_filesystem_tree_it_current_key */
-static int spl_filesystem_tree_it_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)
+static int spl_filesystem_tree_it_current_key(zend_object_iterator *iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)
 {
        spl_filesystem_dir_it *iterator = (spl_filesystem_dir_it *)iter;
        spl_filesystem_object *object   = iterator->object;
        
        if (object->flags & SPL_FILE_DIR_KEY_AS_FILENAME) {
                *str_key_len = strlen(object->u.dir.entry.d_name) + 1;
-               *str_key = estrndup(object->u.dir.entry.d_name, *str_key_len - 1);
+               str_key->s = estrndup(object->u.dir.entry.d_name, *str_key_len - 1);
        } else {
                spl_filesystem_object_get_file_name(object TSRMLS_CC);
                *str_key_len = object->file_name_len + 1;
-               *str_key = estrndup(object->file_name, object->file_name_len);
+               str_key->s = estrndup(object->file_name, object->file_name_len);
        }
        return HASH_KEY_IS_STRING;
 }
@@ -1634,7 +1634,7 @@ static int spl_filesystem_file_call(INTERNAL_FUNCTION_PARAMETERS, spl_filesystem
 
        zend_get_parameters_array_ex(ZEND_NUM_ARGS(), params+(arg2 ? 2 : 1));
 
-       ZVAL_STRING(&z_fname, func_ptr->common.function_name, 0);
+       ZVAL_STRING(&z_fname, func_ptr->common.function_name.s, 0);
 
        fci.size = sizeof(fci);
        fci.function_table = EG(function_table);
index 860659e603e5a4f92fe36799c3cd60512a7dfd45..cfa6d3c14bff849ac616488062b747d1b309b271 100755 (executable)
@@ -42,8 +42,9 @@ void spl_instantiate(zend_class_entry *pce, zval **object, int alloc TSRMLS_DC);
 static inline int spl_instantiate_arg_ex1(zend_class_entry *pce, zval **retval, int alloc, zval *arg1 TSRMLS_DC)
 {
        spl_instantiate(pce, retval, alloc TSRMLS_CC);
-       
-       zend_call_method(retval, pce, &pce->constructor, pce->constructor->common.function_name, strlen(pce->constructor->common.function_name), NULL, 1, arg1, NULL TSRMLS_CC);
+
+       /* FIXME: Unicode support??? */
+       zend_call_method(retval, pce, &pce->constructor, pce->constructor->common.function_name.s, strlen(pce->constructor->common.function_name.s), NULL, 1, arg1, NULL TSRMLS_CC);
        return 0;
 }
 /* }}} */
@@ -53,7 +54,8 @@ static inline int spl_instantiate_arg_ex2(zend_class_entry *pce, zval **retval,
 {
        spl_instantiate(pce, retval, alloc TSRMLS_CC);
        
-       zend_call_method(retval, pce, &pce->constructor, pce->constructor->common.function_name, strlen(pce->constructor->common.function_name), NULL, 2, arg1, arg2 TSRMLS_CC);
+       /* FIXME: Unicode support??? */
+       zend_call_method(retval, pce, &pce->constructor, pce->constructor->common.function_name.s, strlen(pce->constructor->common.function_name.s), NULL, 2, arg1, arg2 TSRMLS_CC);
        return 0;
 }
 /* }}} */
index 72820049297cad787e5ae86589275c354a084496..c2a45af5d084cdc92f1aa7c77f1953d3a6d65ff8 100755 (executable)
@@ -161,7 +161,7 @@ static void spl_recursive_it_get_current_data(zend_object_iterator *iter, zval *
        sub_iter->funcs->get_current_data(sub_iter, data TSRMLS_CC);
 }
 
-static int spl_recursive_it_get_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)
+static int spl_recursive_it_get_current_key(zend_object_iterator *iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)
 {
        spl_recursive_it_object   *object = (spl_recursive_it_object*)iter->data;
        zend_object_iterator      *sub_iter = object->iterators[object->level].iterator;
@@ -473,7 +473,7 @@ SPL_METHOD(RecursiveIteratorIterator, key)
        zend_object_iterator      *iterator = object->iterators[object->level].iterator;
 
        if (iterator->funcs->get_current_key) {
-               char *str_key;
+               zstr str_key;
                uint str_key_len;
                ulong int_key;
                
@@ -482,10 +482,10 @@ SPL_METHOD(RecursiveIteratorIterator, key)
                                RETURN_LONG(int_key);
                                break;
                        case HASH_KEY_IS_STRING:
-                               RETURN_STRINGL(str_key, str_key_len-1, 0);
+                               RETURN_STRINGL(str_key.s, str_key_len-1, 0);
                                break;
                        case HASH_KEY_IS_UNICODE:
-                               RETURN_UNICODEL((void*)str_key, str_key_len-1, 0);
+                               RETURN_UNICODEL(str_key.u, str_key_len-1, 0);
                                break;
                        default:
                                RETURN_NULL();
@@ -652,7 +652,7 @@ SPL_METHOD(RecursiveIteratorIterator, getMaxDepth)
        }
 } /* }}} */
 
-static union _zend_function *spl_recursive_it_get_method(zval **object_ptr, char *method, int method_len TSRMLS_DC)
+static union _zend_function *spl_recursive_it_get_method(zval **object_ptr, zstr method, int method_len TSRMLS_DC)
 {
        union _zend_function    *function_handler;
        spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(*object_ptr TSRMLS_CC);
@@ -661,7 +661,7 @@ static union _zend_function *spl_recursive_it_get_method(zval **object_ptr, char
        
        function_handler = std_object_handlers.get_method(object_ptr, method, method_len TSRMLS_CC);
        if (!function_handler) {
-               if (zend_hash_find(&Z_OBJCE_P(zobj)->function_table, method, method_len+1, (void **) &function_handler) == FAILURE) {
+               if (zend_u_hash_find(&Z_OBJCE_P(zobj)->function_table, UG(unicode)?IS_UNICODE:IS_STRING, method, method_len+1, (void **) &function_handler) == FAILURE) {
                        if (Z_OBJ_HT_P(zobj)->get_method) {
                                *object_ptr = zobj;
                                function_handler = Z_OBJ_HT_P(*object_ptr)->get_method(object_ptr, method, method_len TSRMLS_CC);
@@ -769,7 +769,7 @@ static int spl_dual_it_gets_implemented(zend_class_entry *interface, zend_class_
 }
 #endif
 
-static union _zend_function *spl_dual_it_get_method(zval **object_ptr, char *method, int method_len TSRMLS_DC)
+static union _zend_function *spl_dual_it_get_method(zval **object_ptr, zstr method, int method_len TSRMLS_DC)
 {
        union _zend_function *function_handler;
        spl_dual_it_object   *intern;
@@ -778,7 +778,7 @@ static union _zend_function *spl_dual_it_get_method(zval **object_ptr, char *met
 
        function_handler = std_object_handlers.get_method(object_ptr, method, method_len TSRMLS_CC);
        if (!function_handler) {
-               if (zend_hash_find(&intern->inner.ce->function_table, method, method_len+1, (void **) &function_handler) == FAILURE) {
+               if (zend_u_hash_find(&intern->inner.ce->function_table, UG(unicode)?IS_UNICODE:IS_STRING, method, method_len+1, (void **) &function_handler) == FAILURE) {
                        if (Z_OBJ_HT_P(intern->inner.zobject)->get_method) {
                                *object_ptr = intern->inner.zobject;
                                function_handler = Z_OBJ_HT_P(*object_ptr)->get_method(object_ptr, method, method_len TSRMLS_CC);
@@ -1007,9 +1007,9 @@ static inline void spl_dual_it_free(spl_dual_it_object *intern TSRMLS_DC)
                zval_ptr_dtor(&intern->current.data);
                intern->current.data = NULL;
        }
-       if (intern->current.str_key) {
-               efree(intern->current.str_key);
-               intern->current.str_key = NULL;
+       if (intern->current.str_key.v) {
+               efree(intern->current.str_key.v);
+               intern->current.str_key.v = NULL;
        }
        if (intern->dit_type == DIT_CachingIterator || intern->dit_type == DIT_RecursiveCachingIterator) {
                if (intern->u.caching.zstr) {
@@ -1112,9 +1112,9 @@ SPL_METHOD(dual_it, key)
 
        if (intern->current.data) {
                if (intern->current.key_type == HASH_KEY_IS_STRING) {
-                       RETURN_STRINGL(intern->current.str_key, intern->current.str_key_len-1, 1);
+                       RETURN_STRINGL(intern->current.str_key.s, intern->current.str_key_len-1, 1);
                } else if (intern->current.key_type == HASH_KEY_IS_UNICODE) {
-                       RETURN_UNICODEL((UChar *)intern->current.str_key, intern->current.str_key_len-1, 1);
+                       RETURN_UNICODEL(intern->current.str_key.u, intern->current.str_key_len-1, 1);
                } else {
                        RETURN_LONG(intern->current.int_key);
                }
@@ -1303,7 +1303,8 @@ SPL_METHOD(RegExIterator, accept)
                        subject = &tmp[0];
                } else {
                        subject_len = intern->current.str_key_len;
-                       subject = intern->current.str_key;
+                       /* FIXME: Unicode support??? */
+                       subject = intern->current.str_key.s;
                }
        } else {
                zend_make_printable_zval(intern->current.data, &subject_copy, &use_copy);
@@ -1752,9 +1753,9 @@ SPL_METHOD(CachingIterator, __toString)
        }
        if (intern->u.caching.flags & CIT_TOSTRING_USE_KEY) {
                if (intern->current.key_type == HASH_KEY_IS_STRING) {
-                       RETURN_STRINGL(intern->current.str_key, intern->current.str_key_len, 1);
+                       RETURN_STRINGL(intern->current.str_key.s, intern->current.str_key_len, 1);
                } else if (intern->current.key_type == HASH_KEY_IS_UNICODE) {
-                       RETURN_UNICODEL((void*)intern->current.str_key, intern->current.str_key_len, 1);
+                       RETURN_UNICODEL(intern->current.str_key.u, intern->current.str_key_len, 1);
                } else {
                        RETVAL_LONG(intern->current.int_key);
                        convert_to_string(return_value);
@@ -1780,7 +1781,7 @@ SPL_METHOD(CachingIterator, __toString)
 SPL_METHOD(CachingIterator, offsetSet)
 {
        spl_dual_it_object   *intern;
-       void *arKey;
+       zstr arKey;
        uint nKeyLength;
        zend_uchar type;
        zval *value;
@@ -1805,7 +1806,7 @@ SPL_METHOD(CachingIterator, offsetSet)
 SPL_METHOD(CachingIterator, offsetGet)
 {
        spl_dual_it_object   *intern;
-       void *arKey;
+       zstr arKey;
        uint nKeyLength;
        zend_uchar type;
        zval **value;
@@ -1834,7 +1835,7 @@ SPL_METHOD(CachingIterator, offsetGet)
 SPL_METHOD(CachingIterator, offsetUnset)
 {
        spl_dual_it_object   *intern;
-       void *arKey;
+       zstr arKey;
        uint nKeyLength;
        zend_uchar type;
 
@@ -1857,7 +1858,7 @@ SPL_METHOD(CachingIterator, offsetUnset)
 SPL_METHOD(CachingIterator, offsetExists)
 {
        spl_dual_it_object   *intern;
-       void *arKey;
+       zstr arKey;
        uint nKeyLength;
        zend_uchar type;
        
@@ -2060,7 +2061,7 @@ SPL_METHOD(NoRewindIterator, key)
        intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
 
        if (intern->inner.iterator->funcs->get_current_key) {
-               char *str_key;
+               zstr str_key;
                uint str_key_len;
                ulong int_key;
                switch (intern->inner.iterator->funcs->get_current_key(intern->inner.iterator, &str_key, &str_key_len, &int_key TSRMLS_CC)) {
@@ -2068,10 +2069,10 @@ SPL_METHOD(NoRewindIterator, key)
                                RETURN_LONG(int_key);
                                break;  
                        case HASH_KEY_IS_STRING:
-                               RETURN_STRINGL(str_key, str_key_len-1, 0);
+                               RETURN_STRINGL(str_key.s, str_key_len-1, 0);
                                break;
                        case HASH_KEY_IS_UNICODE:
-                               RETURN_UNICODEL((void*)str_key, str_key_len-1, 0);
+                               RETURN_UNICODEL(str_key.u, str_key_len-1, 0);
                                break;
                        default:
                                RETURN_NULL();
@@ -2357,7 +2358,7 @@ PHP_FUNCTION(iterator_to_array)
 {
        zval                   *obj, **data;
        zend_object_iterator   *iter;
-       char                   *str_key;
+       zstr                    str_key;
        uint                    str_key_len;
        ulong                   int_key;
        int                     key_type;
@@ -2380,12 +2381,12 @@ PHP_FUNCTION(iterator_to_array)
                        key_type = iter->funcs->get_current_key(iter, &str_key, &str_key_len, &int_key TSRMLS_CC);
                        switch(key_type) {
                                case HASH_KEY_IS_STRING:
-                                       add_assoc_zval_ex(return_value, str_key, str_key_len, *data);
-                                       efree(str_key);
+                                       add_assoc_zval_ex(return_value, str_key.s, str_key_len, *data);
+                                       efree(str_key.s);
                                        break;
                                case HASH_KEY_IS_UNICODE:
                                        add_u_assoc_zval_ex(return_value, IS_UNICODE, str_key, str_key_len, *data);
-                                       efree(str_key);
+                                       efree(str_key.u);
                                        break;
                                case HASH_KEY_IS_LONG:
                                        add_index_zval(return_value, int_key, *data);
index 09eb5fc3b9aa8c34ec60df1e2bbd21b133e4f414..ce2e4056cf1aeee84412a39c97428947f7801384 100755 (executable)
@@ -100,7 +100,7 @@ typedef struct _spl_dual_it_object {
        } inner;
        struct {
                zval                 *data;
-               char                 *str_key;
+               zstr                 str_key;
                uint                 str_key_len;
                ulong                int_key;
                int                  key_type; /* HASH_KEY_IS_STRING or HASH_KEY_IS_LONG */
index 2d66a78937abaa817718e9588a568fcdb70c309c..1068a1d0abe14a74d0b4f38518fe04e64516fd68 100644 (file)
@@ -946,11 +946,11 @@ void sqlite_iterator_get_current_data(zend_object_iterator *iter, zval ***data T
 
 }
 
-int sqlite_iterator_get_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)
+int sqlite_iterator_get_current_key(zend_object_iterator *iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)
 {
        struct php_sqlite_result *res = ((sqlite_object_iterator*)iter)->res;
 
-       *str_key = NULL;
+       str_key->v = NULL;
        *str_key_len = 0;
        *int_key = res ? res->curr_row : 0;
        return HASH_KEY_IS_LONG;
@@ -2043,7 +2043,7 @@ PHP_FUNCTION(sqlite_fetch_object)
        zend_bool decode_binary = 1;
        struct php_sqlite_result *res;
        zval *object = getThis();
-       char *class_name;
+       zstr class_name;
        int class_name_len;
        zend_class_entry *ce;
        zval dataset;
index ee1980b71798f21cfedfa6ed473aefec6e06a7f2..62ab109ea32518d9a9074608d98cce8e342ec6c5 100644 (file)
@@ -177,11 +177,11 @@ static int array_key_compare(const void *a, const void *b TSRMLS_DC)
                Z_LVAL(first) = f->h;
        } else if (f->key.type == IS_UNICODE) {
                Z_TYPE(first) = IS_UNICODE;
-               Z_USTRVAL(first) = f->key.u.unicode;
+               Z_USTRVAL(first) = f->key.arKey.u;
                Z_USTRLEN(first) = f->nKeyLength-1;
        } else {
                Z_TYPE(first) = f->key.type;
-               Z_STRVAL(first) = f->key.u.string;
+               Z_STRVAL(first) = f->key.arKey.s;
                Z_STRLEN(first) = f->nKeyLength-1;
        }
 
@@ -190,11 +190,11 @@ static int array_key_compare(const void *a, const void *b TSRMLS_DC)
                Z_LVAL(second) = s->h;
        } else if (s->key.type == IS_UNICODE) {
                Z_TYPE(second) = IS_UNICODE;
-               Z_USTRVAL(second) = s->key.u.unicode;
+               Z_USTRVAL(second) = s->key.arKey.u;
                Z_USTRLEN(second) = s->nKeyLength-1;
        } else {
                Z_TYPE(second) = s->key.type;
-               Z_STRVAL(second) = s->key.u.string;
+               Z_STRVAL(second) = s->key.arKey.s;
                Z_STRLEN(second) = s->nKeyLength-1;
        }
  
@@ -721,11 +721,11 @@ static int array_user_key_compare(const void *a, const void *b TSRMLS_DC)
                Z_LVAL(key1) = f->h;
                Z_TYPE(key1) = IS_LONG;
        } else if (f->key.type == IS_UNICODE) {
-               Z_USTRVAL(key1) = eustrndup(f->key.u.unicode, f->nKeyLength-1);
+               Z_USTRVAL(key1) = eustrndup(f->key.arKey.u, f->nKeyLength-1);
                Z_USTRLEN(key1) = f->nKeyLength-1;
                Z_TYPE(key1) = IS_UNICODE;
        } else {
-               Z_STRVAL(key1) = estrndup(f->key.u.string, f->nKeyLength-1);
+               Z_STRVAL(key1) = estrndup(f->key.arKey.s, f->nKeyLength-1);
                Z_STRLEN(key1) = f->nKeyLength-1;
                Z_TYPE(key1) = f->key.type;
        }
@@ -733,11 +733,11 @@ static int array_user_key_compare(const void *a, const void *b TSRMLS_DC)
                Z_LVAL(key2) = s->h;
                Z_TYPE(key2) = IS_LONG;
        } else if (s->key.type == IS_UNICODE) {
-               Z_USTRVAL(key2) = eustrndup(s->key.u.unicode, s->nKeyLength-1);
+               Z_USTRVAL(key2) = eustrndup(s->key.arKey.u, s->nKeyLength-1);
                Z_USTRLEN(key2) = s->nKeyLength-1;
                Z_TYPE(key2) = IS_UNICODE;
        } else {
-               Z_STRVAL(key2) = estrndup(s->key.u.string, s->nKeyLength-1);
+               Z_STRVAL(key2) = estrndup(s->key.arKey.s, s->nKeyLength-1);
                Z_STRLEN(key2) = s->nKeyLength-1;
                Z_TYPE(key2) = s->key.type;
        }
@@ -926,7 +926,7 @@ PHP_FUNCTION(current)
 PHP_FUNCTION(key)
 {
        zval **array;
-       char *string_key;
+       zstr string_key;
        uint string_length;
        ulong num_key;
        HashTable *target_hash;
@@ -941,10 +941,10 @@ PHP_FUNCTION(key)
        }
        switch (zend_hash_get_current_key_ex(target_hash, &string_key, &string_length, &num_key, 0, NULL)) {
                case HASH_KEY_IS_STRING:
-                       RETVAL_STRINGL(string_key, string_length - 1, 1);
+                       RETVAL_STRINGL(string_key.s, string_length - 1, 1);
                        break;
                case HASH_KEY_IS_UNICODE:
-                       RETVAL_UNICODEL((UChar*)string_key, string_length - 1, 1);
+                       RETVAL_UNICODEL(string_key.u, string_length - 1, 1);
                        break;
                case HASH_KEY_IS_LONG:
                        RETVAL_LONG(num_key);
@@ -1059,7 +1059,7 @@ static int php_array_walk(HashTable *target_hash, zval **userdata, int recursive
        zval **args[3],                 /* Arguments to userland function */
                  *retval_ptr,                  /* Return value - unused */
                  *key=NULL;                            /* Entry key */
-       char  *string_key;
+       zstr string_key;
        uint   string_key_len;
        ulong  num_key;
        HashPosition pos;
@@ -1096,10 +1096,10 @@ static int php_array_walk(HashTable *target_hash, zval **userdata, int recursive
                                        Z_LVAL_P(key) = num_key;
                                        break;
                                case HASH_KEY_IS_STRING:
-                                       ZVAL_STRINGL(key, string_key, string_key_len-1, 1);
+                                       ZVAL_STRINGL(key, string_key.s, string_key_len-1, 1);
                                        break;
                                case HASH_KEY_IS_UNICODE:
-                                       ZVAL_UNICODEL(key, (UChar*)string_key, string_key_len-1, 1);
+                                       ZVAL_UNICODEL(key, string_key.u, string_key_len-1, 1);
                                        break;
                        }
 
@@ -1234,7 +1234,7 @@ static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior)
        HashPosition pos;                       /* hash iterator */
        ulong num_key;
        uint str_key_len;
-       char *string_key;
+       zstr string_key;
        int (*is_equal_func)(zval *, zval *, zval * TSRMLS_DC) = is_equal_function;
 
        if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > 3 ||
@@ -1266,10 +1266,10 @@ static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior)
                                /* Return current key */
                                switch (zend_hash_get_current_key_ex(target_hash, &string_key, &str_key_len, &num_key, 0, &pos)) {
                                        case HASH_KEY_IS_STRING:
-                                               RETURN_STRINGL(string_key, str_key_len-1, 1);
+                                               RETURN_STRINGL(string_key.s, str_key_len-1, 1);
                                                break;
                                        case HASH_KEY_IS_UNICODE:
-                                               RETURN_UNICODEL((UChar*)string_key, str_key_len-1, 1);
+                                               RETURN_UNICODEL(string_key.u, str_key_len-1, 1);
                                                break;
                                        case HASH_KEY_IS_LONG:
                                                RETURN_LONG(num_key);
@@ -1332,7 +1332,7 @@ PHP_FUNCTION(extract)
 {
        zval **var_array, **z_extract_type, **prefix;
        zval **entry, *data;
-       void *var_name;
+       zstr var_name;
        ulong num_key;
        uint var_name_len;
        int var_exists, extract_type, key_type, count = 0;
@@ -1393,7 +1393,7 @@ PHP_FUNCTION(extract)
 
                ZVAL_NULL(&final_name);
 
-               key_type = zend_hash_get_current_key_ex(Z_ARRVAL_PP(var_array), (char **)&var_name, &var_name_len, &num_key, 0, &pos);
+               key_type = zend_hash_get_current_key_ex(Z_ARRVAL_PP(var_array), &var_name, &var_name_len, &num_key, 0, &pos);
                var_exists = 0;
 
                if (key_type == HASH_KEY_IS_STRING ||
@@ -1438,7 +1438,8 @@ PHP_FUNCTION(extract)
                                /* break omitted intentionally */
 
                        case EXTR_OVERWRITE:
-                               if (var_exists && !strcmp(var_name, "GLOBALS")) {
+                               /* FIXME: Unicode support??? */
+                               if (var_exists && !strcmp(var_name.s, "GLOBALS")) {
                                        break;
                                }
                        
@@ -1453,13 +1454,13 @@ PHP_FUNCTION(extract)
                                                Z_USTRVAL(final_name) = eumalloc(Z_USTRLEN(final_name)+1);
                                                memcpy(Z_USTRVAL(final_name), Z_USTRVAL_PP(prefix), UBYTES(Z_USTRLEN_PP(prefix)));
                                                Z_USTRVAL(final_name)[Z_USTRLEN_PP(prefix)] = '_';
-                                               memcpy(Z_USTRVAL(final_name)+Z_USTRLEN_PP(prefix)+1, var_name, UBYTES(var_name_len+1));
+                                               memcpy(Z_USTRVAL(final_name)+Z_USTRLEN_PP(prefix)+1, var_name.u, UBYTES(var_name_len+1));
                                        } else {
                                                Z_TYPE(final_name) = IS_STRING;
                                                Z_STRVAL(final_name) = emalloc(Z_STRLEN(final_name)+1);
                                                memcpy(Z_STRVAL(final_name), Z_STRVAL_PP(prefix), Z_STRLEN_PP(prefix));
                                                Z_STRVAL(final_name)[Z_STRLEN_PP(prefix)] = '_';
-                                               memcpy(Z_STRVAL(final_name)+Z_STRLEN_PP(prefix)+1, var_name, var_name_len+1);
+                                               memcpy(Z_STRVAL(final_name)+Z_STRLEN_PP(prefix)+1, var_name.s, var_name_len+1);
                                        }
                                }
                                break;
@@ -1478,33 +1479,34 @@ PHP_FUNCTION(extract)
                                                Z_USTRVAL(final_name) = eumalloc(Z_USTRLEN(final_name)+1);
                                                memcpy(Z_USTRVAL(final_name), Z_USTRVAL_PP(prefix), UBYTES(Z_USTRLEN_PP(prefix)));
                                                Z_USTRVAL(final_name)[Z_USTRLEN_PP(prefix)] = '_';
-                                               memcpy(Z_USTRVAL(final_name)+Z_USTRLEN_PP(prefix)+1, var_name, UBYTES(var_name_len+1));
+                                               memcpy(Z_USTRVAL(final_name)+Z_USTRLEN_PP(prefix)+1, var_name.u, UBYTES(var_name_len+1));
                                        } else {
                                                Z_TYPE(final_name) = IS_STRING;
                                                Z_STRVAL(final_name) = emalloc(Z_STRLEN(final_name)+1);
                                                memcpy(Z_STRVAL(final_name), Z_STRVAL_PP(prefix), Z_STRLEN_PP(prefix));
                                                Z_STRVAL(final_name)[Z_STRLEN_PP(prefix)] = '_';
-                                               memcpy(Z_STRVAL(final_name)+Z_STRLEN_PP(prefix)+1, var_name, var_name_len+1);
+                                               memcpy(Z_STRVAL(final_name)+Z_STRLEN_PP(prefix)+1, var_name.s, var_name_len+1);
                                        }
                                }
                                break;
 
                        case EXTR_PREFIX_INVALID:
                                if (Z_TYPE(final_name) == IS_NULL) {
-                                       if (!php_valid_var_name(var_name)) {
+                                       /* FIXME: Unicode support??? */
+                                       if (!php_valid_var_name(var_name.s)) {
                                          Z_STRLEN(final_name) = Z_UNILEN_PP(prefix) + 1 + var_name_len;
                                          if (UG(unicode)) {
                                                        Z_TYPE(final_name) = IS_UNICODE;
                                                        Z_USTRVAL(final_name) = eumalloc(Z_USTRLEN(final_name)+1);
                                                        memcpy(Z_USTRVAL(final_name), Z_USTRVAL_PP(prefix), UBYTES(Z_USTRLEN_PP(prefix)));
                                                        Z_USTRVAL(final_name)[Z_USTRLEN_PP(prefix)] = '_';
-                                                       memcpy(Z_USTRVAL(final_name)+Z_USTRLEN_PP(prefix)+1, var_name, UBYTES(var_name_len+1));
+                                                       memcpy(Z_USTRVAL(final_name)+Z_USTRLEN_PP(prefix)+1, var_name.u, UBYTES(var_name_len+1));
                                                } else {
                                                        Z_TYPE(final_name) = IS_STRING;
                                                        Z_STRVAL(final_name) = emalloc(Z_STRLEN(final_name)+1);
                                                        memcpy(Z_STRVAL(final_name), Z_STRVAL_PP(prefix), Z_STRLEN_PP(prefix));
                                                        Z_STRVAL(final_name)[Z_STRLEN_PP(prefix)] = '_';
-                                                       memcpy(Z_STRVAL(final_name)+Z_STRLEN_PP(prefix)+1, var_name, var_name_len+1);
+                                                       memcpy(Z_STRVAL(final_name)+Z_STRLEN_PP(prefix)+1, var_name.s, var_name_len+1);
                                                }
                                        } else {
                                                ZVAL_TEXTL(&final_name, var_name, var_name_len, 1);
@@ -1520,7 +1522,8 @@ PHP_FUNCTION(extract)
                }
 
                if (Z_TYPE(final_name) != IS_NULL) {
-                       if (php_valid_var_name(Z_UNIVAL(final_name))) {
+                       /* FIXME: Unicode support??? */
+                       if (php_valid_var_name(Z_STRVAL(final_name))) {
                                if (extract_refs) {
                                        zval **orig_var;
 
@@ -1984,7 +1987,7 @@ HashTable* php_splice(HashTable *in_hash, int offset, int length,
                if (p->nKeyLength == 0) {
                        zend_hash_next_index_insert(out_hash, &entry, sizeof(zval *), NULL);
                } else {
-                       zend_u_hash_update(out_hash, p->key.type, &p->key.u, p->nKeyLength, &entry, sizeof(zval *), NULL);
+                       zend_u_hash_update(out_hash, p->key.type, (zstr)p->key.arKey.s, p->nKeyLength, &entry, sizeof(zval *), NULL);
                }
        }
        
@@ -1996,7 +1999,7 @@ HashTable* php_splice(HashTable *in_hash, int offset, int length,
                        if (p->nKeyLength == 0) {
                                zend_hash_next_index_insert(*removed, &entry, sizeof(zval *), NULL);
                        } else {                        
-                               zend_u_hash_update(*removed, p->key.type, &p->key.u, p->nKeyLength, &entry, sizeof(zval *), NULL);
+                               zend_u_hash_update(*removed, p->key.type, (zstr)p->key.arKey.s, p->nKeyLength, &entry, sizeof(zval *), NULL);
                        }
                }
        } else /* otherwise just skip those entries */
@@ -2029,7 +2032,7 @@ HashTable* php_splice(HashTable *in_hash, int offset, int length,
                if (p->nKeyLength == 0) {
                        zend_hash_next_index_insert(out_hash, &entry, sizeof(zval *), NULL);
                } else {
-                       zend_u_hash_update(out_hash, p->key.type, &p->key.u, p->nKeyLength, &entry, sizeof(zval *), NULL);
+                       zend_u_hash_update(out_hash, p->key.type, (zstr)p->key.arKey.s, p->nKeyLength, &entry, sizeof(zval *), NULL);
                }
        }
 
@@ -2090,7 +2093,7 @@ static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end)
 {
        zval **stack,                   /* Input stack */
             **val;                     /* Value to be popped */
-       char *key = NULL;
+       zstr key = (zstr)NULL;
        int key_len = 0;
        ulong index;
        zend_uchar key_type;
@@ -2119,12 +2122,12 @@ static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end)
        
        /* Delete the first or last value */
        key_type = zend_hash_get_current_key_ex(Z_ARRVAL_PP(stack), &key, &key_len, &index, 0, NULL);
-       if (key && Z_ARRVAL_PP(stack) == &EG(symbol_table)) {
+       if (key.v && Z_ARRVAL_PP(stack) == &EG(symbol_table)) {
                if (key_type == HASH_KEY_IS_UNICODE) key_type = IS_UNICODE;
                else key_type = IS_STRING;
                zend_u_delete_global_variable(key_type, key, key_len-1 TSRMLS_CC);
        } else {
-               zend_hash_del_key_or_index(Z_ARRVAL_PP(stack), key, key_len, index, (key) ? HASH_DEL_KEY : HASH_DEL_INDEX);
+               zend_u_hash_del_key_or_index(Z_ARRVAL_PP(stack), key_type, key, key_len, index, (key.v) ? HASH_DEL_KEY : HASH_DEL_INDEX);
        }
        
        /* If we did a shift... re-index like it did before */
@@ -2317,7 +2320,7 @@ PHP_FUNCTION(array_slice)
                     pos,               /* Current position in the array */
                     argc;              /* Number of function arguments */
                                 
-       char *string_key;
+       zstr string_key;
        uint string_key_len;
        ulong num_key;
        HashPosition hpos;
@@ -2417,7 +2420,7 @@ ukey:
 PHPAPI int php_array_merge(HashTable *dest, HashTable *src, int recursive TSRMLS_DC)
 {
        zval **src_entry, **dest_entry;
-       char *string_key;
+       zstr string_key;
        uint string_key_len;
        ulong num_key;
        HashPosition pos;
@@ -2537,7 +2540,7 @@ PHP_FUNCTION(array_keys)
             **strict,          /* be strict */
              *new_val;         /* New value */
        int    add_key;         /* Flag to indicate whether a key should be added */
-       char  *string_key;      /* String key */
+       zstr   string_key;      /* String key */
        uint   string_key_len;
        ulong  num_key;         /* Numeric key */
        HashPosition pos;
@@ -2580,10 +2583,10 @@ PHP_FUNCTION(array_keys)
 
                        switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(input), &string_key, &string_key_len, &num_key, 1, &pos)) {
                                case HASH_KEY_IS_STRING:
-                                       ZVAL_STRINGL(new_val, string_key, string_key_len-1, 0);
+                                       ZVAL_STRINGL(new_val, string_key.s, string_key_len-1, 0);
                                        goto ukey;
                                case HASH_KEY_IS_UNICODE:
-                                       ZVAL_UNICODEL(new_val, (UChar*)string_key, string_key_len-1, 0);
+                                       ZVAL_UNICODEL(new_val, string_key.u, string_key_len-1, 0);
 ukey:
                                        zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &new_val,
                                                                                                sizeof(zval *), NULL);
@@ -2734,7 +2737,7 @@ PHP_FUNCTION(array_reverse)
        zval    **input,                          /* Input array */
                **z_preserve_keys, /* Flag: whether to preserve keys */
                **entry;                          /* An entry in the input array */
-       char     *string_key;
+       zstr      string_key;
        uint      string_key_len;
        ulong     num_key;
        zend_bool preserve_keys = 0;
@@ -2866,7 +2869,7 @@ PHP_FUNCTION(array_flip)
 {
        zval **array, **entry, *data;
        HashTable *target_hash;
-       char *string_key;
+       zstr string_key;
        uint str_key_len;
        ulong num_key;
        HashPosition pos;
@@ -2888,10 +2891,10 @@ PHP_FUNCTION(array_flip)
                MAKE_STD_ZVAL(data);
                switch (zend_hash_get_current_key_ex(target_hash, &string_key, &str_key_len, &num_key, 1, &pos)) {
                        case HASH_KEY_IS_STRING:
-                               ZVAL_STRINGL(data, string_key, str_key_len-1, 0);
+                               ZVAL_STRINGL(data, string_key.s, str_key_len-1, 0);
                                break;
                        case HASH_KEY_IS_UNICODE:
-                               ZVAL_UNICODEL(data, (UChar *)string_key, str_key_len-1, 0);
+                               ZVAL_UNICODEL(data, string_key.u, str_key_len-1, 0);
                                break;
                        case HASH_KEY_IS_LONG:
                                Z_TYPE_P(data) = IS_LONG;
@@ -2920,8 +2923,8 @@ PHP_FUNCTION(array_flip)
 PHP_FUNCTION(array_change_key_case)
 {
        zval **array, **entry, **to_upper;
-       char *string_key;
-       char *new_key;
+       zstr string_key;
+       zstr new_key;
        uint str_key_len;
        ulong num_key;
        ulong change_to_upper=0;
@@ -2954,28 +2957,24 @@ PHP_FUNCTION(array_change_key_case)
                                zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, entry, sizeof(entry), NULL);
                                break;
                        case HASH_KEY_IS_STRING:
-                               new_key = estrndup(string_key,str_key_len - 1);
+                               new_key.s = estrndup(string_key.s, str_key_len - 1);
                                if (change_to_upper)
-                                       php_strtoupper(new_key, str_key_len - 1);
+                                       php_strtoupper(new_key.s, str_key_len - 1);
                                else
-                                       php_strtolower(new_key, str_key_len - 1);
+                                       php_strtolower(new_key.s, str_key_len - 1);
                                zend_u_hash_update(Z_ARRVAL_P(return_value), IS_STRING, new_key, str_key_len, entry, sizeof(entry), NULL);
-                               efree(new_key);
+                               efree(new_key.s);
                                break;
                        case HASH_KEY_IS_UNICODE:
-                               {
-                                       UChar *new_key_u;
-
-                                       new_key_u = eustrndup((UChar *)string_key,str_key_len - 1);
-                                       str_key_len--;
-                                       if (change_to_upper)
-                                               new_key_u = php_u_strtoupper(&new_key_u, &str_key_len, UG(default_locale));
-                                       else
-                                               new_key_u = php_u_strtolower(&new_key_u, &str_key_len, UG(default_locale));
-                                       str_key_len++;
-                                       zend_u_hash_update(Z_ARRVAL_P(return_value), IS_UNICODE, new_key_u, str_key_len, entry, sizeof(entry), NULL);
-                                       efree(new_key_u);
-                               }
+                               new_key.u = eustrndup(string_key.u, str_key_len - 1);
+                               str_key_len--;
+                               if (change_to_upper)
+                                       new_key.u = php_u_strtoupper(&new_key.u, &str_key_len, UG(default_locale));
+                               else
+                                       new_key.u = php_u_strtolower(&new_key.u, &str_key_len, UG(default_locale));
+                               str_key_len++;
+                               zend_u_hash_update(Z_ARRVAL_P(return_value), IS_UNICODE, new_key, str_key_len, entry, sizeof(entry), NULL);
+                               efree(new_key.u);
                                break;
                }
 
@@ -3043,9 +3042,9 @@ PHP_FUNCTION(array_unique)
                                zend_hash_index_del(Z_ARRVAL_P(return_value), p->h);
                        } else {
                                if (Z_ARRVAL_P(return_value) == &EG(symbol_table)) {
-                                       zend_u_delete_global_variable(p->key.type, &p->key.u, p->nKeyLength-1 TSRMLS_CC);
+                                       zend_u_delete_global_variable(p->key.type, (zstr)p->key.arKey.s, p->nKeyLength-1 TSRMLS_CC);
                                } else {
-                                       zend_u_hash_del(Z_ARRVAL_P(return_value), p->key.type, &p->key.u, p->nKeyLength);
+                                       zend_u_hash_del(Z_ARRVAL_P(return_value), p->key.type, (zstr)p->key.arKey.s, p->nKeyLength);
                                }
                        }
                }
@@ -3303,7 +3302,7 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
                                        if (p->nKeyLength == 0) {
                                                zend_hash_index_del(Z_ARRVAL_P(return_value), p->h);
                                        } else {
-                                               zend_u_hash_del(Z_ARRVAL_P(return_value), p->key.type, &p->key.u, p->nKeyLength);
+                                               zend_u_hash_del(Z_ARRVAL_P(return_value), p->key.type, (zstr)p->key.arKey.s, p->nKeyLength);
                                        }
                                }
                        }
@@ -3319,7 +3318,7 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
                                if (p->nKeyLength == 0) {
                                        zend_hash_index_del(Z_ARRVAL_P(return_value), p->h);  
                                } else {
-                                       zend_u_hash_del(Z_ARRVAL_P(return_value), p->key.type, &p->key.u, p->nKeyLength);  
+                                       zend_u_hash_del(Z_ARRVAL_P(return_value), p->key.type, (zstr)p->key.arKey.s, p->nKeyLength);  
                                }
                                if (!*++ptrs[0]) { 
                                        goto out;
@@ -3702,7 +3701,7 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
                                if (p->nKeyLength == 0) {
                                        zend_hash_index_del(Z_ARRVAL_P(return_value), p->h);
                                } else {
-                                       zend_u_hash_del(Z_ARRVAL_P(return_value), p->key.type, &p->key.u, p->nKeyLength);
+                                       zend_u_hash_del(Z_ARRVAL_P(return_value), p->key.type, (zstr)p->key.arKey.s, p->nKeyLength);
                                }
                                if (!*++ptrs[0]) {
                                        goto out;
@@ -4050,7 +4049,7 @@ PHP_FUNCTION(array_rand)
        zval **input, **num_req;
        long randval;
        int num_req_val, num_avail, key_type;
-       char *string_key;
+       zstr string_key;
        uint string_key_len;
        ulong num_key;
        HashPosition pos;
@@ -4092,18 +4091,18 @@ PHP_FUNCTION(array_rand)
                        /* If we are returning a single result, just do it. */
                        if (Z_TYPE_P(return_value) != IS_ARRAY) {
                                if (key_type == HASH_KEY_IS_STRING) {
-                                       RETURN_STRINGL(string_key, string_key_len-1, 1);
+                                       RETURN_STRINGL(string_key.s, string_key_len-1, 1);
                                } else if (key_type == HASH_KEY_IS_UNICODE) {
-                                       RETURN_UNICODEL((UChar *)string_key, string_key_len-1, 1);
+                                       RETURN_UNICODEL(string_key.u, string_key_len-1, 1);
                                } else {
                                        RETURN_LONG(num_key);
                                }
                        } else {
                                /* Append the result to the return value. */
                                if (key_type == HASH_KEY_IS_STRING)
-                                       add_next_index_stringl(return_value, string_key, string_key_len-1, 1);
+                                       add_next_index_stringl(return_value, string_key.s, string_key_len-1, 1);
                                else if (key_type == HASH_KEY_IS_UNICODE)
-                                       add_next_index_unicodel(return_value, (UChar *)string_key, string_key_len-1, 1);
+                                       add_next_index_unicodel(return_value, string_key.u, string_key_len-1, 1);
                                else
                                        add_next_index_long(return_value, num_key);
                        }
@@ -4320,7 +4319,7 @@ PHP_FUNCTION(array_filter)
        zval **args[1];
        zval *retval = NULL;
        zval callback_name;
-       char *string_key;
+       zstr string_key;
        zend_fcall_info_cache fci_cache = empty_fcall_info_cache;
        uint string_key_len;
        ulong num_key;
@@ -4490,7 +4489,7 @@ PHP_FUNCTION(array_map)
        for (k = 0; k < maxlen; k++) {
                uint str_key_len;
                ulong num_key;
-               char *str_key;
+               zstr str_key;
                int key_type = 0;
 
                /*
@@ -4631,7 +4630,7 @@ PHP_FUNCTION(array_chunk)
 {
        int argc = ZEND_NUM_ARGS(), key_type;
        long size, current = 0;
-       char *str_key;
+       zstr str_key;
        uint str_key_len;
        ulong num_key;
        zend_bool preserve_keys = 0;
index 1738fb9a744fa471c6bc75f67bb94fd8b466978b..577f5a10ad4684ec0dfcdc666b7e88f619a303ee 100644 (file)
@@ -1236,7 +1236,7 @@ PHP_FUNCTION(constant)
        }
        convert_to_string_ex(const_name);
 
-       if (!zend_u_get_constant(Z_TYPE_PP(const_name), Z_STRVAL_PP(const_name), Z_STRLEN_PP(const_name), return_value TSRMLS_CC)) {
+       if (!zend_u_get_constant(Z_TYPE_PP(const_name), Z_UNIVAL_PP(const_name), Z_UNILEN_PP(const_name), return_value TSRMLS_CC)) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't find constant %s", Z_STRVAL_PP(const_name));
                RETURN_NULL();
        }
@@ -2516,8 +2516,8 @@ static int php_ini_get_option(zend_ini_entry *ini_entry, int num_args, va_list a
        }
 
        if (hash_key->nKeyLength == 0 || 
-                       hash_key->type != IS_STRING ||
-           hash_key->u.string[0] != 0) {
+           hash_key->type != IS_STRING ||
+           hash_key->arKey.s[0] != 0) {
 
                MAKE_STD_ZVAL(option);
                array_init(option);
@@ -3179,7 +3179,8 @@ static int copy_request_variable(void *pDest, int num_args, va_list args, zend_h
                if (!hash_key->nKeyLength) {
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Numeric key detected - possible security hazard.");
                        return 0;
-               } else if (!strcmp(hash_key->u.string, "GLOBALS")) {
+               /* FIXME: Unicode support??? */
+               } else if (!strcmp(hash_key->arKey.s, "GLOBALS")) {
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempted GLOBALS variable overwrite.");
                        return 0; 
                }
@@ -3190,7 +3191,8 @@ static int copy_request_variable(void *pDest, int num_args, va_list args, zend_h
                new_key = (char *) emalloc(new_key_len);
 
                memcpy(new_key, prefix, prefix_len);
-               memcpy(new_key+prefix_len, hash_key->u.string, hash_key->nKeyLength);
+               /* FIXME: Unicode support??? */
+               memcpy(new_key+prefix_len, hash_key->arKey.s, hash_key->nKeyLength);
        } else {
                new_key_len = spprintf(&new_key, 0, "%s%ld", prefix, hash_key->h);
        }
index d80b90eeea653dcb53c0cb3d81a00b5a3d87095a..2dba03f73f0a4635c22dc8f2d0ef6ed218aaa58c 100644 (file)
@@ -31,7 +31,8 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
                                const char *key_suffix, int key_suffix_len,
                                zval *type, char *arg_sep TSRMLS_DC)
 {
-       char *key = NULL, *ekey, *newprefix, *p;
+       zstr key;
+       char *ekey, *newprefix, *p;
        int arg_sep_len, key_len, ekey_len, key_type, newprefix_len;
        ulong idx;
        zval **zdata = NULL, *copyzval;
@@ -57,22 +58,23 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
                (key_type = zend_hash_get_current_key_ex(ht, &key, &key_len, &idx, 0, NULL)) != HASH_KEY_NON_EXISTANT;
                zend_hash_move_forward(ht)
        ) {
-               if (key_type == HASH_KEY_IS_STRING && key_len && key[key_len-1] == '\0') {
+               if (key_type == HASH_KEY_IS_STRING && key_len && key.s[key_len-1] == '\0') {
                        /* We don't want that trailing NULL */
                        key_len -= 1;
                }
 
                /* handling for private & protected object properties */
-               if (key && *key == '\0' && type != NULL) {
-                       char *tmp;
+               /* FIXME: Unicode support??? */
+               if (key.s && key.s[0] == '\0' && type != NULL) {
+                       zstr tmp;
 
                        zend_object *zobj = zend_objects_get_address(type TSRMLS_CC);
                        if (zend_check_property_access(zobj, IS_STRING, key TSRMLS_CC) != SUCCESS) {
                                /* private or protected property access outside of the class */
                                continue;
                        }
-                       zend_unmangle_property_name(key, &tmp, &key);
-                       key_len = strlen(key);          
+                       zend_u_unmangle_property_name(key_type, key, &tmp, &key);
+                       key_len = strlen(key.s);                
                }
 
                if (zend_hash_get_current_data_ex(ht, (void **)&zdata, NULL) == FAILURE || !zdata || !(*zdata)) {
@@ -81,7 +83,7 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
                }
                if (Z_TYPE_PP(zdata) == IS_ARRAY || Z_TYPE_PP(zdata) == IS_OBJECT) {
                        if (key_type == HASH_KEY_IS_STRING) {
-                               ekey = php_url_encode(key, key_len, &ekey_len);
+                               ekey = php_url_encode(key.s, key_len, &ekey_len);
                                newprefix_len = key_suffix_len + ekey_len + key_prefix_len + 1;
                                newprefix = emalloc(newprefix_len + 1);
                                p = newprefix;
@@ -142,7 +144,7 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
                        /* Simple key=value */
                        smart_str_appendl(formstr, key_prefix, key_prefix_len);
                        if (key_type == HASH_KEY_IS_STRING) {
-                               ekey = php_url_encode(key, key_len, &ekey_len);
+                               ekey = php_url_encode(key.s, key_len, &ekey_len);
                                smart_str_appendl(formstr, ekey, ekey_len);
                                efree(ekey);
                        } else {
index c14413657e23dc61eccf4b10d6bf80a236a57371..054fa94cb45ffc76c93dd477f939ccaa2d951797 100644 (file)
@@ -38,12 +38,13 @@ static zend_object_handlers php_incomplete_object_handlers;
  */
 static void incomplete_class_message(zval *object, int error_type TSRMLS_DC)
 {
-       char *class_name;
+       zstr class_name;
 
        class_name = php_lookup_class_name(object, NULL);
        
-       if (!class_name) {
-               class_name = "unknown";
+       /* FIXME: Unicode support??? */
+       if (!class_name.s) {
+               class_name.s = "unknown";
        }
        
        php_error_docref(NULL TSRMLS_CC, error_type, INCOMPLETE_CLASS_MSG, class_name);
@@ -82,7 +83,7 @@ static int incomplete_class_has_property(zval *object, zval *member, int check_e
        return 0;
 }
 
-static union _zend_function *incomplete_class_get_method(zval **object, char *method, int method_len TSRMLS_DC) {
+static union _zend_function *incomplete_class_get_method(zval **object, zstr method, int method_len TSRMLS_DC) {
        incomplete_class_message(*object, E_ERROR TSRMLS_CC);
        return NULL;
 }
@@ -122,23 +123,23 @@ zend_class_entry *php_create_incomplete_class(TSRMLS_D)
 
 /* {{{ php_lookup_class_name
  */
-PHPAPI char *php_lookup_class_name(zval *object, zend_uint *nlen)
+PHPAPI zstr php_lookup_class_name(zval *object, zend_uint *nlen)
 {
        zval **val;
-       char *retval = NULL;
+       zstr retval = (zstr)NULL;
        HashTable *object_properties;
        TSRMLS_FETCH();
 
        object_properties = Z_OBJPROP_P(object);
 
        if (zend_hash_find(object_properties, MAGIC_MEMBER, sizeof(MAGIC_MEMBER), (void **) &val) == SUCCESS) {
-               retval = estrndup(Z_STRVAL_PP(val), Z_STRLEN_PP(val));
+               retval.s = estrndup(Z_STRVAL_PP(val), Z_STRLEN_PP(val));
 
                if (nlen)
                        *nlen = Z_STRLEN_PP(val);
        }
 
-       return (retval);
+       return retval;
 }
 /* }}} */
 
index 83af001cb34a573dd1279c26e8701be6562fa305..a6513a18d8499d48accf146ff8b5d964f692ab07 100644 (file)
@@ -96,7 +96,7 @@ static int _display_module_info(zend_module_entry *module, void *arg TSRMLS_DC)
 static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC)
 {
        zval **data, **tmp, tmp2;
-       char *string_key;
+       zstr string_key;
        uint string_len;
        ulong num_key;
        char *elem_esc = NULL;
@@ -119,11 +119,11 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC)
                        switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(data), &string_key, &string_len, &num_key, 0, NULL)) {
                                case HASH_KEY_IS_STRING:
                                        if (!sapi_module.phpinfo_as_text) {
-                                               elem_esc = php_info_html_esc(string_key TSRMLS_CC);
+                                               elem_esc = php_info_html_esc(string_key.s TSRMLS_CC);
                                                PUTS(elem_esc);
                                                efree(elem_esc);
                                        } else {
-                                               PUTS(string_key);
+                                               PUTS(string_key.s);
                                        }       
                                        break;
                                case HASH_KEY_IS_LONG:
@@ -506,7 +506,8 @@ PHPAPI void php_print_info(int flag TSRMLS_DC)
 #endif
                {
                        HashTable *url_stream_wrappers_hash;
-                       char *stream_protocol, *stream_protocols_buf = NULL;
+                       zstr stream_protocol;
+                       char *stream_protocols_buf = NULL;
                        int stream_protocol_len, stream_protocols_buf_len = 0;
                        ulong num_key;
 
@@ -515,7 +516,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC)
                                                zend_hash_get_current_key_ex(url_stream_wrappers_hash, &stream_protocol, &stream_protocol_len, &num_key, 0, NULL) == HASH_KEY_IS_STRING;
                                                zend_hash_move_forward(url_stream_wrappers_hash)) {
                                        stream_protocols_buf = erealloc(stream_protocols_buf, stream_protocols_buf_len + stream_protocol_len + 2 + 1);
-                                       memcpy(stream_protocols_buf + stream_protocols_buf_len, stream_protocol, stream_protocol_len);
+                                       memcpy(stream_protocols_buf + stream_protocols_buf_len, stream_protocol.s, stream_protocol_len);
                                        stream_protocols_buf[stream_protocols_buf_len + stream_protocol_len] = ',';
                                        stream_protocols_buf[stream_protocols_buf_len + stream_protocol_len + 1] = ' ';
                                        stream_protocols_buf_len += stream_protocol_len + 2;
@@ -537,7 +538,8 @@ PHPAPI void php_print_info(int flag TSRMLS_DC)
 
                {
                        HashTable *stream_xport_hash;
-                       char *xport_name, *xport_buf = NULL;
+                       zstr xport_name;
+                       char *xport_buf = NULL;
                        int xport_name_len, xport_buf_len = 0, xport_buf_size = 0;
                        ulong num_key;
 
@@ -559,7 +561,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC)
                                                xport_buf[xport_buf_len++] = ',';
                                                xport_buf[xport_buf_len++] = ' ';
                                        }
-                                       memcpy(xport_buf + xport_buf_len, xport_name, xport_name_len);
+                                       memcpy(xport_buf + xport_buf_len, xport_name.s, xport_name_len);
                                        xport_buf_len += xport_name_len;
                                        xport_buf[xport_buf_len] = '\0';
                                }
@@ -578,7 +580,8 @@ PHPAPI void php_print_info(int flag TSRMLS_DC)
 
                {
                        HashTable *stream_filter_hash;
-                       char *filter_name, *filter_buf = NULL;
+                       zstr filter_name;
+                       char *filter_buf = NULL;
                        int filter_name_len, filter_buf_len = 0, filter_buf_size = 0;
                        ulong num_key;
 
@@ -600,7 +603,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC)
                                                filter_buf[filter_buf_len++] = ',';
                                                filter_buf[filter_buf_len++] = ' ';
                                        }
-                                       memcpy(filter_buf + filter_buf_len, filter_name, filter_name_len);
+                                       memcpy(filter_buf + filter_buf_len, filter_name.s, filter_name_len);
                                        filter_buf_len += filter_name_len;
                                        filter_buf[filter_buf_len] = '\0';
                                }
index 9e18a3b223af657a7d8c47c15e5100017625297e..426347896e2be306ae466f740a13e7b941de464b 100644 (file)
        }
 
 #define PHP_CLEANUP_CLASS_ATTRIBUTES() \
-       if (free_class_name) efree(class_name)
+       if (free_class_name) efree(class_name.v)
 
 #define PHP_CLASS_ATTRIBUTES                                                                                   \
-       char *class_name;                                                                                                       \
+       zstr class_name;                                                                                                        \
        zend_uint name_len;                                                                                                     \
        zend_bool free_class_name = 0;                                                                          \
        zend_bool incomplete_class = 0
@@ -55,7 +55,7 @@ extern "C" {
        
 zend_class_entry *php_create_incomplete_class(TSRMLS_D);
 
-PHPAPI char *php_lookup_class_name(zval *object, zend_uint *nlen);
+PHPAPI zstr php_lookup_class_name(zval *object, zend_uint *nlen);
 PHPAPI void  php_store_class_name(zval *object, const char *name, zend_uint len);
 
 #ifdef __cplusplus
index eb6eecc15e72ad62f5e1d3231a0413154e95204f..4d2dbca64407c523932b8a54f5fe7cd09fd06806 100644 (file)
@@ -75,7 +75,8 @@ static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent
 {
        zval **element;
        php_process_env_t env;
-       char *string_key, *data;
+       zstr string_key;
+       char *data;
 #ifndef PHP_WIN32
        char **ep;
 #endif
@@ -148,7 +149,7 @@ static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent
                                        continue;
                                }
                                l = string_length + el_len + 1;
-                               memcpy(p, string_key, string_length);
+                               memcpy(p, string_key.s, string_length);
                                strcat(p, "=");
                                strcat(p, data);
                                
@@ -478,14 +479,14 @@ PHP_FUNCTION(proc_open)
        /* walk the descriptor spec and set up files/pipes */
        zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(descriptorspec), &pos);
        while (zend_hash_get_current_data_ex(Z_ARRVAL_P(descriptorspec), (void **)&descitem, &pos) == SUCCESS) {
-               char *str_index;
+               zstr str_index;
                ulong nindex;
                zval **ztype;
 
-               str_index = NULL;
+               str_index.v = NULL;
                zend_hash_get_current_key_ex(Z_ARRVAL_P(descriptorspec), &str_index, NULL, &nindex, 0, &pos);
 
-               if (str_index) {
+               if (str_index.v) {
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "descriptor spec must be an integer indexed array");
                        goto exit_fail;
                }
index 4dd1dda5be4a2ac6853c175738fd60ee0e8417a7..9b5818a9b19ea6f692e89b01a110b5c5c8d92254 100644 (file)
@@ -523,7 +523,7 @@ PHP_FUNCTION(stream_get_meta_data)
 PHP_FUNCTION(stream_get_transports)
 {
        HashTable *stream_xport_hash;
-       char *stream_xport;
+       zstr stream_xport;
        int stream_xport_len;
        ulong num_key;
 
@@ -537,7 +537,7 @@ PHP_FUNCTION(stream_get_transports)
                while (zend_hash_get_current_key_ex(stream_xport_hash,
                                        &stream_xport, &stream_xport_len,
                                        &num_key, 0, NULL) == HASH_KEY_IS_STRING) {
-                       add_next_index_stringl(return_value, stream_xport, stream_xport_len, 1);
+                       add_next_index_stringl(return_value, stream_xport.s, stream_xport_len, 1);
                        zend_hash_move_forward(stream_xport_hash);
                }
        } else {
@@ -551,7 +551,7 @@ PHP_FUNCTION(stream_get_transports)
 PHP_FUNCTION(stream_get_wrappers)
 {
        HashTable *url_stream_wrappers_hash;
-       char *stream_protocol;
+       zstr stream_protocol;
        int key_flags, stream_protocol_len = 0;
        ulong num_key;
 
@@ -565,7 +565,7 @@ PHP_FUNCTION(stream_get_wrappers)
                        (key_flags = zend_hash_get_current_key_ex(url_stream_wrappers_hash, &stream_protocol, &stream_protocol_len, &num_key, 0, NULL)) != HASH_KEY_NON_EXISTANT;
                        zend_hash_move_forward(url_stream_wrappers_hash)) {
                                if (key_flags == HASH_KEY_IS_STRING) {
-                                       add_next_index_stringl(return_value, stream_protocol, stream_protocol_len, 1);
+                                       add_next_index_stringl(return_value, stream_protocol.s, stream_protocol_len, 1);
                                }
                }
        } else {
@@ -850,7 +850,7 @@ static int parse_context_options(php_stream_context *context, zval *options TSRM
 {
        HashPosition pos, opos;
        zval **wval, **oval;
-       char *wkey, *okey;
+       zstr wkey, okey;
        int wkey_len, okey_len;
        int ret = SUCCESS;
        ulong num_key;
@@ -864,7 +864,7 @@ static int parse_context_options(php_stream_context *context, zval *options TSRM
                                /* fold to string */
                                UErrorCode errCode = 0;
 
-                               zend_convert_from_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &wkey, &wkey_len, (UChar*)wkey, wkey_len, &errCode);
+                               zend_convert_from_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &wkey.s, &wkey_len, wkey.u, wkey_len, &errCode);
                        }
 
                        zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(wval), &opos);
@@ -874,17 +874,17 @@ static int parse_context_options(php_stream_context *context, zval *options TSRM
                                        /* fold to string */
                                        UErrorCode errCode = 0;
        
-                                       zend_convert_from_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &okey, &okey_len, (UChar*)okey, okey_len, &errCode);
-                                       php_stream_context_set_option(context, wkey, okey, *oval);
-                                       efree(okey);
+                                       zend_convert_from_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &okey.s, &okey_len, okey.u, okey_len, &errCode);
+                                       php_stream_context_set_option(context, wkey.s, okey.s, *oval);
+                                       efree(okey.v);
                                }
                                if (HASH_KEY_IS_STRING == otype) {
-                                       php_stream_context_set_option(context, wkey, okey, *oval);
+                                       php_stream_context_set_option(context, wkey.s, okey.s, *oval);
                                }
                                zend_hash_move_forward_ex(Z_ARRVAL_PP(wval), &opos);
                        }
                        if (wtype == HASH_KEY_IS_UNICODE) {
-                               efree(wkey);
+                               efree(wkey.v);
                        }
                } else {
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "options should have the form [\"wrappername\"][\"optionname\"] = $value");
@@ -912,7 +912,7 @@ static int parse_context_params(php_stream_context *context, zval *params TSRMLS
        U_STRING_INIT(u_default_mode, "default_mode", 12);
 
        if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "notification", sizeof("notification"), (void**)&tmp) ||
-               SUCCESS == zend_u_hash_find(Z_ARRVAL_P(params), IS_UNICODE, u_notification, sizeof("notification"), (void**)&tmp)) {
+               SUCCESS == zend_u_hash_find(Z_ARRVAL_P(params), IS_UNICODE, (zstr)u_notification, sizeof("notification"), (void**)&tmp)) {
                
                if (context->notifier) {
                        php_stream_notification_free(context->notifier);
@@ -926,11 +926,11 @@ static int parse_context_params(php_stream_context *context, zval *params TSRMLS
                context->notifier->dtor = user_space_stream_notifier_dtor;
        }
        if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "options", sizeof("options"), (void**)&tmp) ||
-               SUCCESS == zend_u_hash_find(Z_ARRVAL_P(params), IS_UNICODE, u_options, sizeof("options"), (void**)&tmp)) {
+               SUCCESS == zend_u_hash_find(Z_ARRVAL_P(params), IS_UNICODE, (zstr)u_options, sizeof("options"), (void**)&tmp)) {
                parse_context_options(context, *tmp TSRMLS_CC);
        }
        if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "input_encoding", sizeof("input_encoding"), (void**)&tmp) ||
-               SUCCESS == zend_u_hash_find(Z_ARRVAL_P(params), IS_UNICODE, u_input_encoding, sizeof("input_encoding"), (void**)&tmp)) {
+               SUCCESS == zend_u_hash_find(Z_ARRVAL_P(params), IS_UNICODE, (zstr)u_input_encoding, sizeof("input_encoding"), (void**)&tmp)) {
                zval strval = **tmp;
 
                if (context->input_encoding) {
@@ -942,7 +942,7 @@ static int parse_context_params(php_stream_context *context, zval *params TSRMLS
                context->input_encoding = Z_STRVAL(strval);
        }
        if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "output_encoding", sizeof("output_encoding"), (void**)&tmp) ||
-               SUCCESS == zend_u_hash_find(Z_ARRVAL_P(params), IS_UNICODE, u_output_encoding, sizeof("output_encoding"), (void**)&tmp)) {
+               SUCCESS == zend_u_hash_find(Z_ARRVAL_P(params), IS_UNICODE, (zstr)u_output_encoding, sizeof("output_encoding"), (void**)&tmp)) {
                zval strval = **tmp;
 
                if (context->output_encoding) {
@@ -954,7 +954,7 @@ static int parse_context_params(php_stream_context *context, zval *params TSRMLS
                context->output_encoding = Z_STRVAL(strval);
        }
        if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "default_mode", sizeof("default_mode"), (void**)&tmp) ||
-               SUCCESS == zend_u_hash_find(Z_ARRVAL_P(params), IS_UNICODE, u_default_mode, sizeof("default_mode"), (void**)&tmp)) {
+               SUCCESS == zend_u_hash_find(Z_ARRVAL_P(params), IS_UNICODE, (zstr)u_default_mode, sizeof("default_mode"), (void**)&tmp)) {
                zval longval = **tmp;
 
                zval_copy_ctor(&longval);
index 94bbc603b5ba8a76ef015fdf2c6bb36ef2f7aebf..1cd47a7c76d9e45a75e246b4cd2ea115ca119178 100644 (file)
@@ -2023,7 +2023,7 @@ PHP_FUNCTION(stristr)
        UChar u_needle_char[3];
        int32_t needle_len;
        char *haystack_copy;
-       void *target;
+       zstr target;
        void *found = NULL;
        int found_offset;
        void *start, *end;
@@ -2067,11 +2067,11 @@ PHP_FUNCTION(stristr)
                                u_needle_char[needle_len++] = (UChar)U16_TRAIL(Z_LVAL_P(needle));
                                u_needle_char[needle_len]   = 0;
                        }
-                       target = u_needle_char;
+                       target.u = u_needle_char;
                } else {
                        needle_char[needle_len++] = (char)Z_LVAL_P(needle);
                        needle_char[needle_len] = 0;
-                       target = needle_char;
+                       target.s = needle_char;
                }
        }
 
@@ -2080,11 +2080,11 @@ PHP_FUNCTION(stristr)
        }
 
        if (Z_TYPE_P(haystack) == IS_UNICODE) {
-               found = php_u_stristr(Z_USTRVAL_P(haystack), (UChar *)target,
+               found = php_u_stristr(Z_USTRVAL_P(haystack), target.u,
                                                          Z_USTRLEN_P(haystack), needle_len);
        } else {
                haystack_copy = estrndup(Z_STRVAL_P(haystack), Z_STRLEN_P(haystack));
-               found = php_stristr(Z_STRVAL_P(haystack), (char *)target,
+               found = php_stristr(Z_STRVAL_P(haystack), target.s,
                                                        Z_STRLEN_P(haystack), needle_len);
        }
 
@@ -2356,7 +2356,7 @@ PHP_FUNCTION(stripos)
                if (Z_TYPE_P(haystack) == IS_UNICODE) {
                        haystack_dup = eustrndup(Z_USTRVAL_P(haystack), haystack_len);
                        php_u_strtolower((UChar **)&haystack_dup, &haystack_len, UG(default_locale));
-                       needle_dup = eustrndup(Z_STRVAL_P(needle), needle_len);
+                       needle_dup = eustrndup(Z_USTRVAL_P(needle), needle_len);
                        php_u_strtolower((UChar **)&needle_dup, &needle_len, UG(default_locale));
                        found = zend_u_memnstr((UChar *)haystack_dup + offset,
                                                                   (UChar *)needle_dup, needle_len,
@@ -2441,7 +2441,7 @@ PHP_FUNCTION(stripos)
 PHP_FUNCTION(strrpos)
 {
        zval *zhaystack, *zneedle;
-       void *haystack, *needle;
+       zstr haystack, needle;
        int32_t haystack_len, needle_len = 0;
        zend_uchar str_type;
        long offset = 0;
@@ -2481,12 +2481,12 @@ PHP_FUNCTION(strrpos)
                                u_ord_needle[needle_len++] = (UChar)U16_TRAIL(Z_LVAL_P(zneedle));
                                u_ord_needle[needle_len]   = 0;
                        }
-                       needle = u_ord_needle;
+                       needle.u = u_ord_needle;
                } else {
                        convert_to_long(zneedle);
                        ord_needle[0] = (char)(Z_LVAL_P(zneedle) & 0xFF);
                        ord_needle[1] = '\0';
-                       needle = ord_needle;
+                       needle.s = ord_needle;
                        needle_len = 1;
                }
        }
@@ -2499,44 +2499,44 @@ PHP_FUNCTION(strrpos)
 
        if (Z_TYPE_P(zhaystack) == IS_UNICODE) {
                if (offset >= 0) {
-                       u_p = (UChar *)haystack + offset;
-                       u_e = (UChar *)haystack + haystack_len - needle_len;
+                       u_p = haystack.u + offset;
+                       u_e = haystack.u + haystack_len - needle_len;
                } else {
-                       u_p = haystack;
+                       u_p = haystack.u;
                        if (-offset > haystack_len) {
-                               u_e = (UChar *)haystack - needle_len;
+                               u_e = haystack.u - needle_len;
                        } else if (needle_len > -offset) {
-                               u_e = (UChar *)haystack + haystack_len - needle_len;
+                               u_e = haystack.u + haystack_len - needle_len;
                        } else {
-                               u_e = (UChar *)haystack + haystack_len + offset;
+                               u_e = haystack.u + haystack_len + offset;
                        }
                }
 
-               pos = u_strFindLast(u_p, u_e-u_p+needle_len, (UChar *)needle, needle_len);
+               pos = u_strFindLast(u_p, u_e-u_p+needle_len, needle.u, needle_len);
                if (pos) {
-                       RETURN_LONG(pos - (UChar *)haystack);
+                       RETURN_LONG(pos - haystack.u);
                } else {
                        RETURN_FALSE;
                }
        } else {
                if (offset >= 0) {
-                       p = (char *)haystack + offset;
-                       e = (char *)haystack + haystack_len - needle_len;
+                       p = haystack.s + offset;
+                       e = haystack.s + haystack_len - needle_len;
                } else {
-                       p = haystack;
+                       p = haystack.s;
                        if (-offset > haystack_len) {
-                               e = (char *)haystack - needle_len;
+                               e = haystack.s - needle_len;
                        } else if (needle_len > -offset) {
-                               e = (char *)haystack + haystack_len - needle_len;
+                               e = haystack.s + haystack_len - needle_len;
                        } else {
-                               e = (char *)haystack + haystack_len + offset;
+                               e = haystack.s + haystack_len + offset;
                        }
                }
 
                if (needle_len == 1) {
                        /* Single character search can shortcut memcmps */
                        while (e >= p) {
-                               if (*e == *(char *)needle) {
+                               if (*e == *needle.s) {
                                        RETURN_LONG(e - p + (offset > 0 ? offset : 0));
                                }
                                e--;
@@ -2545,7 +2545,7 @@ PHP_FUNCTION(strrpos)
                }
 
                while (e >= p) {
-                       if (memcmp(e, needle, needle_len) == 0) {
+                       if (memcmp(e, needle.s, needle_len) == 0) {
                                RETURN_LONG(e - p + (offset > 0 ? offset : 0));
                        }
                        e--;
@@ -3429,7 +3429,7 @@ PHPAPI char *php_strtr(char *str, int len, char *str_from, char *str_to, int trl
 static void php_strtr_array(zval *return_value, char *str, int slen, HashTable *hash)
 {
        zval **entry;
-       char  *string_key;
+       zstr   string_key;
        uint   string_key_len;
        zval **trans;
        zval   ctmp;
@@ -3451,7 +3451,7 @@ static void php_strtr_array(zval *return_value, char *str, int slen, HashTable *
                                        zend_hash_destroy(&tmp_hash);
                                        RETURN_FALSE;
                                }
-                               zend_hash_add(&tmp_hash, string_key, string_key_len, entry, sizeof(zval*), NULL);
+                               zend_u_hash_add(&tmp_hash, IS_STRING, string_key, string_key_len, entry, sizeof(zval*), NULL);
                                if (len > maxlen) {
                                        maxlen = len;
                                }
@@ -4650,7 +4650,7 @@ static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensit
 {
        zval **subject, **search, **replace, **subject_entry, **zcount;
        zval *result;
-       char *string_key;
+       zstr string_key;
        uint string_key_len;
        ulong num_key;
        int count = 0;
@@ -4694,7 +4694,7 @@ static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensit
                        switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(subject), &string_key,
                                                                                                &string_key_len, &num_key, 0, NULL)) {
                                case HASH_KEY_IS_STRING:
-                                       add_assoc_zval_ex(return_value, string_key, string_key_len, result);
+                                       add_assoc_zval_ex(return_value, string_key.s, string_key_len, result);
                                        break;
 
                                case HASH_KEY_IS_LONG:
index a50b3cb45d7fc97744addbee184550103fba8149..2f52100f45db6667b1f971d5f0498dcb85a75076 100644 (file)
@@ -226,7 +226,8 @@ static void php_is_type(INTERNAL_FUNCTION_PARAMETERS, int type)
                                RETURN_TRUE;
                        }
                        ce = Z_OBJCE_PP(arg);
-                       if (!strcmp(ce->name, INCOMPLETE_CLASS)) {
+                       /* FIXME: Unicode support??? */
+                       if (!strcmp(ce->name.s, INCOMPLETE_CLASS)) {
                                RETURN_FALSE;
                        }
                }
index 990ab60423d88180fc64b610f2949db080916ddd..fbca919a8ac351e389649f716548070f6beaf427 100644 (file)
@@ -509,7 +509,7 @@ PHP_FUNCTION(stream_bucket_new)
    Returns a list of registered filters */
 PHP_FUNCTION(stream_get_filters)
 {
-       char *filter_name;
+       zstr filter_name;
        int key_flags, filter_name_len = 0;
        HashTable *filters_hash;
        ulong num_key;
@@ -527,7 +527,7 @@ PHP_FUNCTION(stream_get_filters)
                        (key_flags = zend_hash_get_current_key_ex(filters_hash, &filter_name, &filter_name_len, &num_key, 0, NULL)) != HASH_KEY_NON_EXISTANT;
                        zend_hash_move_forward(filters_hash))
                                if (key_flags == HASH_KEY_IS_STRING)
-                                       add_next_index_stringl(return_value, filter_name, filter_name_len, 1);
+                                       add_next_index_stringl(return_value, filter_name.s, filter_name_len, 1);
        }
        /* It's okay to return an empty array if no filters are registered */
 }
index 62556d8ad400367a2e61a8dc4d75216c15fae706..4da79626341e79b2fbd2ca1d967fc6d682dfb4b0 100644 (file)
@@ -120,8 +120,8 @@ static int php_array_element_dump(zval **zv, int num_args, va_list args, zend_ha
                php_printf("%*c[%ld]=>\n", level + 1, ' ', hash_key->h);
        } else { /* string key */
                if (va_arg(args, int) && 
-                   ((hash_key->type == IS_STRING && hash_key->u.string[0] == 0) ||
-                    (hash_key->type == IS_UNICODE && hash_key->u.unicode[0] == '\0'))) { 
+                   ((hash_key->type == IS_STRING && hash_key->arKey.s[0] == 0) ||
+                    (hash_key->type == IS_UNICODE && hash_key->arKey.u[0] == 0))) { 
                        /* XXX: perhaps when we are inside the class we should permit access to 
                         * private & protected values
                         */
@@ -130,11 +130,11 @@ static int php_array_element_dump(zval **zv, int num_args, va_list args, zend_ha
                php_printf("%*c[", level + 1, ' ');
                if (hash_key->type == IS_STRING) {
                        php_printf("\"");
-                       PHPWRITE(hash_key->u.string, hash_key->nKeyLength - 1);
+                       PHPWRITE(hash_key->arKey.s, hash_key->nKeyLength - 1);
                        php_printf("\"");
                } else if (hash_key->type == IS_UNICODE) {
                        php_printf("u");
-                       php_var_dump_unicode(hash_key->u.unicode, hash_key->nKeyLength-1, verbose, "\"", 0 TSRMLS_CC);
+                       php_var_dump_unicode(hash_key->arKey.u, hash_key->nKeyLength-1, verbose, "\"", 0 TSRMLS_CC);
                }
                php_printf("]=>\n");
        }
@@ -145,7 +145,7 @@ static int php_array_element_dump(zval **zv, int num_args, va_list args, zend_ha
 static int php_object_property_dump(zval **zv, int num_args, va_list args, zend_hash_key *hash_key)
 {
        int level;
-       char *prop_name, *class_name;
+       zstr prop_name, class_name;
        int verbose;
        TSRMLS_FETCH();
 
@@ -157,11 +157,11 @@ static int php_object_property_dump(zval **zv, int num_args, va_list args, zend_
        } else { /* string key */
                int is_unicode = hash_key->type == IS_UNICODE;
 
-               zend_u_unmangle_property_name(hash_key->type, hash_key->u.string, &class_name, &prop_name);
+               zend_u_unmangle_property_name(hash_key->type, hash_key->arKey, &class_name, &prop_name);
                php_printf("%*c[", level + 1, ' ');
 
-               if (class_name) {
-                       if (class_name[0]=='*') {
+               if (class_name.s) {
+                       if (class_name.s[0]=='*') {
                                php_printf("%s\"%R\":protected", is_unicode ? "u" : "", hash_key->type, prop_name);
                        } else {
                                php_printf("%s\"%R\":%s\"%R\":private", is_unicode ? "u" : "", hash_key->type, prop_name, is_unicode ? "u" : "", hash_key->type, class_name);
@@ -179,7 +179,7 @@ static int php_object_property_dump(zval **zv, int num_args, va_list args, zend_
 PHPAPI void php_var_dump(zval **struc, int level, int verbose TSRMLS_DC)
 {
        HashTable *myht = NULL;
-       char *class_name;
+       zstr class_name;
        zend_uint class_name_len;
        int (*php_element_dump_func)(zval**, int, va_list, zend_hash_key*);
 
@@ -228,7 +228,7 @@ PHPAPI void php_var_dump(zval **struc, int level, int verbose TSRMLS_DC)
 
                Z_OBJ_HANDLER(**struc, get_class_name)(*struc, &class_name, &class_name_len, 0 TSRMLS_CC);
                php_printf("%sobject(%v)#%d (%d) {\n", COMMON, class_name, Z_OBJ_HANDLE_PP(struc), myht ? zend_hash_num_elements(myht) : 0);
-               efree(class_name);
+               efree(class_name.v);
                php_element_dump_func = php_object_property_dump;
 head_done:
                if (myht) {
@@ -319,18 +319,18 @@ static int zval_array_element_dump(zval **zv, int num_args, va_list args, zend_h
                 * private & protected values
                 */
                if (va_arg(args, int) && 
-                   ((hash_key->type == IS_STRING && hash_key->u.string[0] == 0) ||
-                    (hash_key->type == IS_UNICODE && hash_key->u.unicode[0] == '\0'))) { 
+                   ((hash_key->type == IS_STRING && hash_key->arKey.s[0] == 0) ||
+                    (hash_key->type == IS_UNICODE && hash_key->arKey.u[0] == 0))) { 
                        return 0;
                }
                php_printf("%*c[", level + 1, ' ');
                if (hash_key->type == IS_STRING) {
                        php_printf("\"");
-                       PHPWRITE(hash_key->u.string, hash_key->nKeyLength - 1);
+                       PHPWRITE(hash_key->arKey.s, hash_key->nKeyLength - 1);
                        php_printf("\"");
                } else if (hash_key->type == IS_UNICODE) {
                        php_printf("u");
-                       php_var_dump_unicode(hash_key->u.unicode, hash_key->nKeyLength-1, 1, "\"", 0 TSRMLS_CC);
+                       php_var_dump_unicode(hash_key->arKey.u, hash_key->nKeyLength-1, 1, "\"", 0 TSRMLS_CC);
                }
                php_printf("]=>\n");
        }
@@ -341,7 +341,7 @@ static int zval_array_element_dump(zval **zv, int num_args, va_list args, zend_h
 PHPAPI void php_debug_zval_dump(zval **struc, int level, int verbose TSRMLS_DC)
 {
        HashTable *myht = NULL;
-       char *class_name;
+       zstr class_name;
        zend_uint class_name_len;
        zend_class_entry *ce;
 
@@ -389,7 +389,7 @@ PHPAPI void php_debug_zval_dump(zval **struc, int level, int verbose TSRMLS_DC)
                ce = Z_OBJCE(**struc);
                Z_OBJ_HANDLER(**struc, get_class_name)(*struc, &class_name, &class_name_len, 0 TSRMLS_CC);
                php_printf("%sobject(%v)#%d (%d) refcount(%u){\n", COMMON, class_name, Z_OBJ_HANDLE_PP(struc), myht ? zend_hash_num_elements(myht) : 0, Z_REFCOUNT_PP(struc));
-               efree(class_name);
+               efree(class_name.v);
 head_done:
                if (myht) {
                        zend_hash_apply_with_arguments(myht, (apply_func_args_t) zval_array_element_dump, 1, level, (Z_TYPE_PP(struc) == IS_ARRAY ? 0 : 1));
@@ -452,12 +452,12 @@ static int php_array_element_export(zval **zv, int num_args, va_list args, zend_
        } else { /* string key */
                php_printf("%*c'", level + 1, ' ');
                if (hash_key->type == IS_UNICODE) {
-                       php_var_dump_unicode(hash_key->u.unicode, hash_key->nKeyLength-1, 0, "", 1 TSRMLS_CC);
+                       php_var_dump_unicode(hash_key->arKey.u, hash_key->nKeyLength-1, 0, "", 1 TSRMLS_CC);
                } else {
                        char *key;
                        int key_len;
 
-                       key = php_addcslashes(hash_key->u.string, hash_key->nKeyLength - 1, &key_len, 0, "'\\", 2 TSRMLS_CC);
+                       key = php_addcslashes(hash_key->arKey.s, hash_key->nKeyLength - 1, &key_len, 0, "'\\", 2 TSRMLS_CC);
                        PHPWRITE(key, key_len);
                        efree(key);
                }
@@ -471,14 +471,14 @@ static int php_array_element_export(zval **zv, int num_args, va_list args, zend_
 static int php_object_element_export(zval **zv, int num_args, va_list args, zend_hash_key *hash_key)
 {
        int level;
-       char *prop_name, *class_name;
+       zstr prop_name, class_name;
        TSRMLS_FETCH();
 
        level = va_arg(args, int);
 
        if (hash_key->nKeyLength != 0) {
                php_printf("%*c", level + 1, ' ');
-               zend_u_unmangle_property_name(hash_key->type, hash_key->u.string, &class_name, &prop_name);
+               zend_u_unmangle_property_name(hash_key->type, hash_key->arKey, &class_name, &prop_name);
                php_printf(" '%R' => ", hash_key->type, prop_name);
                php_var_export(zv, level + 2 TSRMLS_CC);
                PUTS (",\n");
@@ -491,7 +491,7 @@ PHPAPI void php_var_export(zval **struc, int level TSRMLS_DC)
        HashTable *myht;
        char*     tmp_str;
        int       tmp_len;
-       char *class_name;
+       zstr      class_name;
        zend_uint class_name_len;
 
        switch (Z_TYPE_PP(struc)) {
@@ -536,7 +536,7 @@ PHPAPI void php_var_export(zval **struc, int level TSRMLS_DC)
                }
                Z_OBJ_HANDLER(**struc, get_class_name)(*struc, &class_name, &class_name_len, 0 TSRMLS_CC);
                php_printf ("%v::__set_state(array(\n", class_name);
-               efree(class_name);
+               efree(class_name.v);
                if (myht) {
                        zend_hash_apply_with_arguments(myht, (apply_func_args_t) php_object_element_export, 1, level);
                }
@@ -671,9 +671,9 @@ static inline zend_bool php_var_serialize_class_name(smart_str *buf, zval **stru
        smart_str_append_long(buf, name_len);
        smart_str_appendl(buf, ":\"", 2);
        if (UG(unicode)) {
-               php_var_serialize_ustr(buf, (UChar*)class_name, name_len);
+               php_var_serialize_ustr(buf, class_name.u, name_len);
        } else {
-               smart_str_appendl(buf, class_name, name_len);
+               smart_str_appendl(buf, class_name.s, name_len);
        }
        smart_str_appendl(buf, "\":", 2);
        PHP_CLEANUP_CLASS_ATTRIBUTES();
@@ -696,7 +696,7 @@ static void php_var_serialize_class(smart_str *buf, zval **struc, zval *retval_p
        smart_str_appendl(buf, ":{", 2);
 
        if (count > 0) {
-               char *key;
+               zstr key;
                zval **d, **name;
                ulong index;
                HashPosition pos;
@@ -715,7 +715,8 @@ static void php_var_serialize_class(smart_str *buf, zval **struc, zval *retval_p
                        if (i == HASH_KEY_NON_EXISTANT)
                                break;
 
-                       if (incomplete_class && strcmp(key, MAGIC_MEMBER) == 0) {
+                       /* FIXME: Unicode support??? */
+                       if (incomplete_class && strcmp(key.s, MAGIC_MEMBER) == 0) {
                                continue;
                        }
                        zend_hash_get_current_data_ex(HASH_OF(retval_ptr), 
@@ -742,36 +743,36 @@ static void php_var_serialize_class(smart_str *buf, zval **struc, zval *retval_p
                                zend_class_entry *ce;
                                ce = zend_get_class_entry(*struc TSRMLS_CC);
                                if (ce) {
-                                       char *prot_name, *priv_name;
+                                       zstr prot_name, priv_name;
                                        int prop_name_length;
                                        
                                        do {
                                                zend_u_mangle_property_name(&priv_name, &prop_name_length, Z_TYPE_PP(name), ce->name, ce->name_length, 
-                                                                       Z_STRVAL_PP(name), Z_STRLEN_PP(name), ce->type & ZEND_INTERNAL_CLASS);
+                                                                       Z_UNIVAL_PP(name), Z_UNILEN_PP(name), ce->type & ZEND_INTERNAL_CLASS);
                                                if (zend_u_hash_find(Z_OBJPROP_PP(struc), Z_TYPE_PP(name), priv_name, prop_name_length+1, (void *) &d) == SUCCESS) {
                                                        if (Z_TYPE_PP(name) == IS_UNICODE) {
-                                                               php_var_serialize_unicode(buf, (UChar *)priv_name, prop_name_length);
+                                                               php_var_serialize_unicode(buf, priv_name.u, prop_name_length);
                                                        } else {
-                                                               php_var_serialize_string(buf, priv_name, prop_name_length);
+                                                               php_var_serialize_string(buf, priv_name.s, prop_name_length);
                                                        }
-                                                       efree(priv_name);
+                                                       efree(priv_name.v);
                                                        php_var_serialize_intern(buf, d, var_hash TSRMLS_CC);
                                                        break;
                                                }
-                                               efree(priv_name);
-                                               zend_u_mangle_property_name(&prot_name, &prop_name_length,  Z_TYPE_PP(name), "*", 1, 
-                                                                       Z_STRVAL_PP(name), Z_STRLEN_PP(name), ce->type & ZEND_INTERNAL_CLASS);
+                                               efree(priv_name.v);
+                                               zend_u_mangle_property_name(&prot_name, &prop_name_length,  Z_TYPE_PP(name), (zstr)"*", 1, 
+                                                                       Z_UNIVAL_PP(name), Z_UNILEN_PP(name), ce->type & ZEND_INTERNAL_CLASS);
                                                if (zend_u_hash_find(Z_OBJPROP_PP(struc), Z_TYPE_PP(name), prot_name, prop_name_length+1, (void *) &d) == SUCCESS) {
                                                        if (Z_TYPE_PP(name) == IS_UNICODE) {
-                                                               php_var_serialize_unicode(buf, (UChar *)prot_name, prop_name_length);
+                                                               php_var_serialize_unicode(buf, prot_name.u, prop_name_length);
                                                        } else {
-                                                               php_var_serialize_string(buf, prot_name, prop_name_length);
+                                                               php_var_serialize_string(buf, prot_name.s, prop_name_length);
                                                        }
-                                                       efree(prot_name);
+                                                       efree(prot_name.v);
                                                        php_var_serialize_intern(buf, d, var_hash TSRMLS_CC);
                                                        break;
                                                }
-                                               efree(prot_name);
+                                               efree(prot_name.v);
                                                php_error_docref(NULL TSRMLS_CC, E_NOTICE, "\"%R\" returned as member variable from __sleep() but does not exist", Z_TYPE_PP(name), Z_UNIVAL_PP(name));
                                                if (Z_TYPE_PP(name) == IS_UNICODE) {
                                                        php_var_serialize_unicode(buf, Z_USTRVAL_PP(name), Z_USTRLEN_PP(name));
@@ -868,7 +869,8 @@ static void php_var_serialize_intern(smart_str *buf, zval **struc, HashTable *va
                                                smart_str_appendl(buf, "C:", 2);
                                                smart_str_append_long(buf, Z_OBJCE_PP(struc)->name_length);
                                                smart_str_appendl(buf, ":\"", 2);
-                                               smart_str_appendl(buf, Z_OBJCE_PP(struc)->name, Z_OBJCE_PP(struc)->name_length);
+                                               /* FIXME: Unicode support??? */
+                                               smart_str_appendl(buf, Z_OBJCE_PP(struc)->name.s, Z_OBJCE_PP(struc)->name_length);
                                                smart_str_appendl(buf, "\":", 2);
                                        
                                                smart_str_append_long(buf, serialized_length);
@@ -933,7 +935,7 @@ static void php_var_serialize_intern(smart_str *buf, zval **struc, HashTable *va
                        smart_str_append_long(buf, i);
                        smart_str_appendl(buf, ":{", 2);
                        if (i > 0) {
-                               char *key;
+                               zstr key;
                                zval **data;
                                ulong index;
                                uint key_len;
@@ -946,7 +948,8 @@ static void php_var_serialize_intern(smart_str *buf, zval **struc, HashTable *va
                                        if (i == HASH_KEY_NON_EXISTANT)
                                                break;
                                        
-                                       if (incomplete_class && strcmp(key, MAGIC_MEMBER) == 0) {
+                                       /* FIXME: Unicode support??? */
+                                       if (incomplete_class && strcmp(key.s, MAGIC_MEMBER) == 0) {
                                                continue;
                                        }               
                                        
@@ -955,10 +958,10 @@ static void php_var_serialize_intern(smart_str *buf, zval **struc, HashTable *va
                                                        php_var_serialize_long(buf, index);
                                                        break;
                                                case HASH_KEY_IS_STRING:
-                                                       php_var_serialize_string(buf, key, key_len - 1);
+                                                       php_var_serialize_string(buf, key.s, key_len - 1);
                                                        break;
                                                case HASH_KEY_IS_UNICODE:
-                                                       php_var_serialize_unicode(buf, (UChar*)key, key_len - 1);
+                                                       php_var_serialize_unicode(buf, key.u, key_len - 1);
                                                        break;
                                        }
 
index 755fe775198f50f64852b5dd7116372bde854b51..239d1ed31d8aacfaba290babae226458f1ed9d7f 100644 (file)
@@ -548,9 +548,9 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c
        char *p;
        int buffer_len = 0;
        char *space;
-       char *class_name = get_active_class_name(&space TSRMLS_CC);
+       zstr class_name = get_active_class_name(&space TSRMLS_CC);
        int origin_len;
-       char *function = NULL;
+       zstr function = (zstr)NULL;
        char *origin;
        char *message;
        char *stage;
@@ -576,19 +576,19 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c
                   EG(current_execute_data)->opline->opcode == ZEND_INCLUDE_OR_EVAL) {
                switch (EG(current_execute_data)->opline->op2.u.constant.value.lval) {
                        case ZEND_EVAL:
-                               function = "eval";
+                               function.s = "eval";
                                break;
                        case ZEND_INCLUDE:
-                               function = "include";
+                               function.s = "include";
                                break;
                        case ZEND_INCLUDE_ONCE:
-                               function = "include_once";
+                               function.s = "include_once";
                                break;
                        case ZEND_REQUIRE:
-                               function = "require";
+                               function.s = "require";
                                break;
                        case ZEND_REQUIRE_ONCE:
-                               function = "require_once";
+                               function.s = "require_once";
                                break;
                        default:
                                stage = "Unknown";
@@ -596,16 +596,16 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c
        } else {
                function_name_is_string = 0;
                function = get_active_function_name(TSRMLS_C);
-               if (!function || !USTR_LEN(function)) {
+               if (!function.v || !USTR_LEN(function)) {
                        stage = "Unknown";
-                       function = NULL;
+                       function.v = NULL;
                }
        }
 
        /* if we still have memory then format the origin */
-       if (function) {
+       if (function.v) {
                if (function_name_is_string) {
-                       origin_len = spprintf(&origin, 0, "%v%s%s(%s)", class_name, space, function, params);   
+                       origin_len = spprintf(&origin, 0, "%v%s%s(%s)", class_name, space, function.s, params); 
                } else {
                        origin_len = spprintf(&origin, 0, "%v%s%v(%s)", class_name, space, function, params);   
                }
@@ -627,9 +627,9 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c
        }
 
        /* no docref given but function is known (the default) */
-       if (!docref && function) {
+       if (!docref && function.v) {
                if (function_name_is_string) {
-                       spprintf(&docref_buf, 0, "function.%s", function);
+                       spprintf(&docref_buf, 0, "function.%s", function.s);
                } else {
                        spprintf(&docref_buf, 0, "function.%v", function);
                }
@@ -643,7 +643,7 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c
         * - we show erroes in html mode OR
         * - the user wants to see the links anyway
         */
-       if (docref && function && (PG(html_errors) || strlen(PG(docref_root)))) {
+       if (docref && function.v && (PG(html_errors) || strlen(PG(docref_root)))) {
                if (strncmp(docref, "http://", 7)) {
                        /* We don't have 'http://' so we use docref_root */
 
index ccd5fa1e0c1820545f2ae3cef7f5ad6d91400524..e60dda96e9dc10940a012b975d62089af4e84edb 100644 (file)
@@ -414,7 +414,7 @@ PHPAPI int php_ob_init_conflict(char *handler_new, char *handler_set TSRMLS_DC)
 
 /* {{{ php_ob_init_named
  */
-static int php_ob_init_named(uint initial_size, uint block_size, zend_uchar type, char *handler_name, zval *output_handler, uint chunk_size, zend_bool erase TSRMLS_DC)
+static int php_ob_init_named(uint initial_size, uint block_size, zend_uchar type, zstr handler_name, zval *output_handler, uint chunk_size, zend_bool erase TSRMLS_DC)
 {
        int handler_len;
 
@@ -422,9 +422,9 @@ static int php_ob_init_named(uint initial_size, uint block_size, zend_uchar type
                return FAILURE;
        }
        if (type == IS_UNICODE) {
-               handler_len = u_strlen(handler_name);
+               handler_len = u_strlen(handler_name.u);
        } else {
-               handler_len = strlen(handler_name);
+               handler_len = strlen(handler_name.s);
        }
        if (OG(ob_nesting_level)>0) {
 #if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB)
@@ -449,9 +449,10 @@ static int php_ob_init_named(uint initial_size, uint block_size, zend_uchar type
        OG(active_ob_buffer).status = 0;
        OG(active_ob_buffer).internal_output_handler = NULL;
        if (type == IS_UNICODE) {
-               OG(active_ob_buffer).handler_name = eustrdup(handler_name&&handler_name[0]?handler_name:OB_DEFAULT_HANDLER_NAME);
+               /* FIXME: Unicode support??? */
+               OG(active_ob_buffer).handler_name = eustrdup((handler_name.u && handler_name.u[0])?handler_name.u:(UChar*)OB_DEFAULT_HANDLER_NAME);
        } else {
-               OG(active_ob_buffer).handler_name = estrdup(handler_name&&handler_name[0]?handler_name:OB_DEFAULT_HANDLER_NAME);
+               OG(active_ob_buffer).handler_name = estrdup((handler_name.s && handler_name.s[0])?handler_name.s:OB_DEFAULT_HANDLER_NAME);
        }
        OG(active_ob_buffer).erase = erase;
        OG(php_body_write) = php_b_body_write;
@@ -509,7 +510,7 @@ static int php_ob_init(uint initial_size, uint block_size, zval *output_handler,
                                len = next_handler_name-handler_name;
                                next_handler_name = estrndup(handler_name, len);
                                handler_zval = php_ob_handler_from_string(next_handler_name, len TSRMLS_CC);
-                               result = php_ob_init_named(initial_size, block_size, IS_STRING, next_handler_name, handler_zval, chunk_size, erase TSRMLS_CC);
+                               result = php_ob_init_named(initial_size, block_size, IS_STRING, (zstr)next_handler_name, handler_zval, chunk_size, erase TSRMLS_CC);
                                if (result != SUCCESS) {
                                        zval_dtor(handler_zval);
                                        FREE_ZVAL(handler_zval);
@@ -521,7 +522,7 @@ static int php_ob_init(uint initial_size, uint block_size, zval *output_handler,
                }
                if (result == SUCCESS) {
                        handler_zval = php_ob_handler_from_string(handler_name, handler_len TSRMLS_CC);
-                       result = php_ob_init_named(initial_size, block_size, IS_STRING, handler_name, handler_zval, chunk_size, erase TSRMLS_CC);
+                       result = php_ob_init_named(initial_size, block_size, IS_STRING, (zstr)handler_name, handler_zval, chunk_size, erase TSRMLS_CC);
                        if (result != SUCCESS) {
                                zval_dtor(handler_zval);
                                FREE_ZVAL(handler_zval);
@@ -538,7 +539,7 @@ static int php_ob_init(uint initial_size, uint block_size, zval *output_handler,
                                len = next_handler_name-handler_name;
                                next_handler_name = eustrndup(handler_name, len);
                                handler_zval = php_ob_handler_from_unicode(next_handler_name, len TSRMLS_CC);
-                               result = php_ob_init_named(initial_size, block_size, IS_UNICODE, next_handler_name, handler_zval, chunk_size, erase TSRMLS_CC);
+                               result = php_ob_init_named(initial_size, block_size, IS_UNICODE, (zstr)next_handler_name, handler_zval, chunk_size, erase TSRMLS_CC);
                                if (result != SUCCESS) {
                                        zval_dtor(handler_zval);
                                        FREE_ZVAL(handler_zval);
@@ -550,7 +551,7 @@ static int php_ob_init(uint initial_size, uint block_size, zval *output_handler,
                }
                if (result == SUCCESS) {
                        handler_zval = php_ob_handler_from_unicode(handler_name, handler_len TSRMLS_CC);
-                       result = php_ob_init_named(initial_size, block_size, IS_UNICODE, handler_name, handler_zval, chunk_size, erase TSRMLS_CC);
+                       result = php_ob_init_named(initial_size, block_size, IS_UNICODE, (zstr)handler_name, handler_zval, chunk_size, erase TSRMLS_CC);
                        if (result != SUCCESS) {
                                zval_dtor(handler_zval);
                                FREE_ZVAL(handler_zval);
@@ -581,7 +582,7 @@ static int php_ob_init(uint initial_size, uint block_size, zval *output_handler,
                php_error_docref(NULL TSRMLS_CC, E_ERROR, "No method name given: use ob_start(array($object,'method')) to specify instance $object and the name of a method of class %v to use as output handler", Z_OBJCE_P(output_handler)->name);
                result = FAILURE;
        } else {
-               result = php_ob_init_named(initial_size, block_size, IS_STRING, OB_DEFAULT_HANDLER_NAME, NULL, chunk_size, erase TSRMLS_CC);
+               result = php_ob_init_named(initial_size, block_size, IS_STRING, (zstr)OB_DEFAULT_HANDLER_NAME, NULL, chunk_size, erase TSRMLS_CC);
        }
        return result;
 }
index 76f20edb8bcd3fbdb092c64f323007f3ad54651d..0555c23e9f7d0f59860e33e4285ae1c38e19c14f 100644 (file)
@@ -336,11 +336,11 @@ PHPAPI void php_u_register_variable_ex(UChar *var, zval *val, zval *track_vars_a
                                } else {
                                        escaped_index = index;
                                }
-                               if (zend_u_symtable_find(symtable1, IS_UNICODE, escaped_index, index_len+1, (void **) &gpc_element_p)==FAILURE
+                               if (zend_u_symtable_find(symtable1, IS_UNICODE, (zstr)escaped_index, index_len+1, (void **) &gpc_element_p)==FAILURE
                                        || Z_TYPE_PP(gpc_element_p) != IS_ARRAY) {
                                        MAKE_STD_ZVAL(gpc_element);
                                        array_init(gpc_element);
-                                       zend_u_symtable_update(symtable1, IS_UNICODE, escaped_index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
+                                       zend_u_symtable_update(symtable1, IS_UNICODE, (zstr)escaped_index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
                                }
                                if (index!=escaped_index) {
                                        efree(escaped_index);
@@ -369,7 +369,7 @@ plain_var:
                                /* UTODO fix for php_addslashes case */
                                //char *escaped_index = php_addslashes(index, index_len, &index_len, 0 TSRMLS_CC);
                                UChar *escaped_index = index;
-                               zend_u_symtable_update(symtable1, IS_UNICODE, escaped_index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
+                               zend_u_symtable_update(symtable1, IS_UNICODE, (zstr)escaped_index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
                                //efree(escaped_index);
                        }
                        break;
@@ -804,7 +804,7 @@ static inline void php_register_server_variables(TSRMLS_D)
 static void php_autoglobal_merge(HashTable *dest, HashTable *src TSRMLS_DC)
 {
        zval **src_entry, **dest_entry;
-       char *string_key;
+       zstr string_key;
        uint string_key_len;
        ulong num_key;
        HashPosition pos;
@@ -814,16 +814,17 @@ static void php_autoglobal_merge(HashTable *dest, HashTable *src TSRMLS_DC)
        zend_hash_internal_pointer_reset_ex(src, &pos);
        while (zend_hash_get_current_data_ex(src, (void **)&src_entry, &pos) == SUCCESS) {
                key_type = zend_hash_get_current_key_ex(src, &string_key, &string_key_len, &num_key, 0, &pos);
+               /* FIXME: Unicode support??? */
                if (Z_TYPE_PP(src_entry) != IS_ARRAY
-                       || (key_type == HASH_KEY_IS_STRING && zend_hash_find(dest, string_key, string_key_len, (void **) &dest_entry) != SUCCESS)
+                       || (key_type == HASH_KEY_IS_STRING && zend_u_hash_find(dest, key_type, string_key, string_key_len, (void **) &dest_entry) != SUCCESS)
                        || (key_type == HASH_KEY_IS_LONG && zend_hash_index_find(dest, num_key, (void **)&dest_entry) != SUCCESS)
                        || Z_TYPE_PP(dest_entry) != IS_ARRAY
         ) {
                        (*src_entry)->refcount++;
                        if (key_type == HASH_KEY_IS_STRING) {
                                /* if register_globals is on and working with main symbol table, prevent overwriting of GLOBALS */
-                               if (!globals_check || string_key_len != sizeof("GLOBALS") || memcmp(string_key, "GLOBALS", sizeof("GLOBALS") - 1)) {
-                                       zend_hash_update(dest, string_key, string_key_len, src_entry, sizeof(zval *), NULL);
+                               if (!globals_check || string_key_len != sizeof("GLOBALS") || memcmp(string_key.s, "GLOBALS", sizeof("GLOBALS") - 1)) {
+                                       zend_u_hash_update(dest, key_type, string_key, string_key_len, src_entry, sizeof(zval *), NULL);
                                } else {
                                        (*src_entry)->refcount--;
                                }
index dce526cbb761484c3cdcbeb3f66265d7b35727f3..72b25bd4e22d2e2392afd66361ec0f7f095aa9d9 100644 (file)
@@ -264,7 +264,7 @@ static void add_u_protected_variable(UChar *varname TSRMLS_DC)
        int dummy=1;
 
        normalize_u_protected_variable(varname TSRMLS_CC);
-       zend_u_hash_add(&PG(rfc1867_protected_variables), IS_UNICODE, varname, u_strlen(varname)+1, &dummy, sizeof(int), NULL);
+       zend_u_hash_add(&PG(rfc1867_protected_variables), IS_UNICODE, (zstr)varname, u_strlen(varname)+1, &dummy, sizeof(int), NULL);
 }
 
 
@@ -278,7 +278,7 @@ static zend_bool is_protected_variable(char *varname TSRMLS_DC)
 static zend_bool is_u_protected_variable(UChar *varname TSRMLS_DC)
 {
        normalize_u_protected_variable(varname TSRMLS_CC);
-       return zend_u_hash_exists(&PG(rfc1867_protected_variables), IS_UNICODE, varname, u_strlen(varname)+1);
+       return zend_u_hash_exists(&PG(rfc1867_protected_variables), IS_UNICODE, (zstr)varname, u_strlen(varname)+1);
 }
 
 
@@ -1316,7 +1316,7 @@ var_done:
                                }
                                temp_filename = EMPTY_STR;
                        } else {
-                               zend_u_hash_add(SG(rfc1867_uploaded_files), IS_UNICODE, temp_filename, u_strlen(temp_filename) + 1, &temp_filename, sizeof(UChar *), NULL);
+                               zend_u_hash_add(SG(rfc1867_uploaded_files), IS_UNICODE, (zstr)temp_filename, u_strlen(temp_filename) + 1, &temp_filename, sizeof(UChar *), NULL);
                        }
 
                        /* is_arr_upload is true when name of file upload field
index 87ff73864a544b264172e11072db8205087499e3..db102f52d779a3ed76d8d12457941db8842ef0e6 100755 (executable)
@@ -2636,7 +2636,9 @@ PHPAPI int php_stream_context_del_link(php_stream_context *context,
         php_stream *stream)
 {
        php_stream **pstream;
-       char *hostent;
+       zend_uchar type;
+       zstr hostent;
+       unsigned int hostent_len;
        int ret = SUCCESS;
 
        if (!context || !context->links || !stream) {
@@ -2647,8 +2649,9 @@ PHPAPI int php_stream_context_del_link(php_stream_context *context,
                SUCCESS == zend_hash_get_current_data(Z_ARRVAL_P(context->links), (void**)&pstream);
                zend_hash_move_forward(Z_ARRVAL_P(context->links))) {
                if (*pstream == stream) {
-                       if (SUCCESS == zend_hash_get_current_key(Z_ARRVAL_P(context->links), &hostent, NULL, 0)) {
-                               if (FAILURE == zend_hash_del(Z_ARRVAL_P(context->links), (char*)hostent, strlen(hostent)+1)) {
+                       type = zend_hash_get_current_key_ex(Z_ARRVAL_P(context->links), &hostent, &hostent_len, NULL, 0, NULL);
+                       if (type == HASH_KEY_IS_STRING || type == HASH_KEY_IS_UNICODE) {
+                               if (FAILURE == zend_u_hash_del(Z_ARRVAL_P(context->links), type, hostent, hostent_len)) {
                                        ret = FAILURE;
                                }
                        } else {
index fa22d26ae7a7cc76da1fea495c522e7ef1e59738..d1a3331eacb4291618e5763f99570d706104f605 100644 (file)
@@ -490,21 +490,21 @@ static void cli_register_file_handles(TSRMLS_D)
        
        ic.value = *zin;
        ic.flags = CONST_CS;
-       ic.name = zend_strndup(ZEND_STRL("STDIN"));
+       ic.name.s = zend_strndup(ZEND_STRL("STDIN"));
        ic.name_len = sizeof("STDIN");
        ic.module_number = 0;
        zend_register_constant(&ic TSRMLS_CC);
 
        oc.value = *zout;
        oc.flags = CONST_CS;
-       oc.name = zend_strndup(ZEND_STRL("STDOUT"));
+       oc.name.s = zend_strndup(ZEND_STRL("STDOUT"));
        oc.name_len = sizeof("STDOUT");
        oc.module_number = 0;
        zend_register_constant(&oc TSRMLS_CC);
 
        ec.value = *zerr;
        ec.flags = CONST_CS;
-       ec.name = zend_strndup(ZEND_STRL("STDERR"));
+       ec.name.s = zend_strndup(ZEND_STRL("STDERR"));
        ec.name_len = sizeof("STDERR");
        ec.module_number = 0;
        zend_register_constant(&ec TSRMLS_CC);