]> granicus.if.org Git - php/commitdiff
Unicode support.
authorDmitry Stogov <dmitry@php.net>
Fri, 17 Nov 2006 10:48:53 +0000 (10:48 +0000)
committerDmitry Stogov <dmitry@php.net>
Fri, 17 Nov 2006 10:48:53 +0000 (10:48 +0000)
Now the real UG(unicode) value is available during MINIT calls.

Zend/zend.c
Zend/zend_API.c
Zend/zend_API.h
Zend/zend_compile.c
Zend/zend_compile.h
Zend/zend_constants.c
Zend/zend_opcode.c
ext/dom/php_dom.c
ext/libxml/libxml.c
ext/spl/spl_functions.c
main/main.c

index fe0446de3a99bc0407f1670df2bb11b5a8d5f518..380c3bfdf5bacb69035ea9b8d6dba44108fec7f6 100644 (file)
@@ -671,7 +671,6 @@ static void zend_set_default_compile_time_values(TSRMLS_D)
 }
 
 
-#define ZEND_U_FUNCTION_DTOR (void (*)(void *)) zend_u_function_dtor
 #define ZEND_U_CONSTANT_DTOR (void (*)(void *)) free_u_zend_constant
 
 static void zval_copy_persistent(zval *zv)
@@ -687,32 +686,6 @@ static void zval_copy_persistent(zval *zv)
        }
 }
 
-static void zend_u_function_dtor(zend_function *function)
-{
-       TSRMLS_FETCH();
-
-       destroy_zend_function(function TSRMLS_CC);
-       if (function->type == ZEND_INTERNAL_FUNCTION) {
-               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.v) {
-                                       free(function->common.arg_info[n].name.v);
-                               }
-                               if (function->common.arg_info[n].class_name.v) {
-                                       free(function->common.arg_info[n].class_name.v);
-                               }
-                       }
-                       free(function->common.arg_info);
-               }
-       }
-}
-
 static void free_u_zend_constant(zend_constant *c)
 {
        if (!(c->flags & CONST_PERSISTENT)) {
@@ -740,17 +713,17 @@ static void function_to_unicode(zend_function *func TSRMLS_DC)
                args = malloc((n + 1) * sizeof(zend_arg_info));
                memcpy(args, func->common.arg_info, (n + 1) * sizeof(zend_arg_info));
                while (n > 0) {
-                 --n;
-                 if (args[n].name.s) {
+                       --n;
+                       if (args[n].name.s) {
                                UChar *uname = malloc(UBYTES(args[n].name_len + 1));
                                u_charsToUChars(args[n].name.s, uname, args[n].name_len+1);
                                args[n].name.u = uname;
-                 }
-                 if (args[n].class_name.s) {
+                       }
+                       if (args[n].class_name.s) {
                                UChar *uname = malloc(UBYTES(args[n].class_name_len + 1));
                                u_charsToUChars(args[n].class_name.s, uname, args[n].class_name_len+1);
                                args[n].class_name.u = uname;
-                 }
+                       }
                }
                func->common.arg_info = args;
        }
@@ -822,11 +795,11 @@ static void compiler_globals_ctor(zend_compiler_globals *compiler_globals TSRMLS
        compiler_globals->compiled_filename = NULL;
 
        compiler_globals->function_table = (HashTable *) malloc(sizeof(HashTable));
-       zend_u_hash_init_ex(compiler_globals->function_table, 100, NULL, ZEND_FUNCTION_DTOR, 1, UG(unicode), 0);
+       zend_u_hash_init_ex(compiler_globals->function_table, global_function_table->nNumOfElements, NULL, ZEND_FUNCTION_DTOR, 1, UG(unicode), 0);
        zend_hash_copy(compiler_globals->function_table, global_function_table, NULL, &tmp_func, sizeof(zend_function));
 
        compiler_globals->class_table = (HashTable *) malloc(sizeof(HashTable));
-       zend_u_hash_init_ex(compiler_globals->class_table, 10, NULL, ZEND_CLASS_DTOR, 1, UG(unicode), 0);
+       zend_u_hash_init_ex(compiler_globals->class_table, global_class_table->nNumOfElements, NULL, ZEND_CLASS_DTOR, 1, UG(unicode), 0);
        zend_hash_copy(compiler_globals->class_table, global_class_table, (copy_ctor_func_t) zend_class_add_ref, &tmp_class, sizeof(zend_class_entry *));
 
        zend_set_default_compile_time_values(TSRMLS_C);
@@ -835,7 +808,7 @@ static void compiler_globals_ctor(zend_compiler_globals *compiler_globals TSRMLS
        CG(literal_type) = IS_STRING;
 
        compiler_globals->auto_globals = (HashTable *) malloc(sizeof(HashTable));
-       zend_u_hash_init_ex(compiler_globals->auto_globals, 8, NULL, NULL, 1, UG(unicode), 0);
+       zend_u_hash_init_ex(compiler_globals->auto_globals, global_auto_globals_table->nNumOfElements, NULL, NULL, 1, UG(unicode), 0);
        zend_hash_copy(compiler_globals->auto_globals, global_auto_globals_table, NULL, NULL, sizeof(zend_auto_global) /* empty element */);
 
        compiler_globals->last_static_member = zend_hash_num_elements(compiler_globals->class_table);
@@ -1135,21 +1108,6 @@ void zend_register_standard_ini_entries(TSRMLS_D)
        int module_number = 0;
 
        REGISTER_INI_ENTRIES();
-}
-
-/* Unlink the global (r/o) copies of the class, function and constant tables,
- * and use a fresh r/w copy for the startup thread
- */
-void zend_post_startup(TSRMLS_D)
-{
-#ifdef ZTS
-       zend_compiler_globals *compiler_globals = ts_resource(compiler_globals_id);
-       zend_executor_globals *executor_globals = ts_resource(executor_globals_id);
-
-       *GLOBAL_FUNCTION_TABLE = *compiler_globals->function_table;
-       *GLOBAL_CLASS_TABLE = *compiler_globals->class_table;
-       *GLOBAL_CONSTANTS_TABLE = *executor_globals->zend_constants;
-#endif
 
        /* Make copies of HashTables with UNICODE */
 
@@ -1160,18 +1118,30 @@ void zend_post_startup(TSRMLS_D)
                old_runtime_encoding_conv = UG(runtime_encoding_conv);
                UG(runtime_encoding_conv) = ucnv_open("ASCII", &status);
 
-               zend_hash_to_unicode(GLOBAL_FUNCTION_TABLE, (apply_func_t)function_to_unicode TSRMLS_CC);
-               GLOBAL_FUNCTION_TABLE->pDestructor = ZEND_U_FUNCTION_DTOR;
-               zend_hash_to_unicode(GLOBAL_CLASS_TABLE, (apply_func_t)class_to_unicode TSRMLS_CC);
-               zend_hash_to_unicode(GLOBAL_AUTO_GLOBALS_TABLE, NULL TSRMLS_CC);
-               zend_hash_to_unicode(GLOBAL_CONSTANTS_TABLE, (apply_func_t)const_to_unicode TSRMLS_CC);
-               GLOBAL_CONSTANTS_TABLE->pDestructor = ZEND_U_CONSTANT_DTOR;
+               zend_hash_to_unicode(CG(function_table), (apply_func_t)function_to_unicode TSRMLS_CC);
+               CG(function_table)->pDestructor = ZEND_U_FUNCTION_DTOR;
+               zend_hash_to_unicode(CG(class_table), (apply_func_t)class_to_unicode TSRMLS_CC);
+               zend_hash_to_unicode(CG(auto_globals), NULL TSRMLS_CC);
+               zend_hash_to_unicode(EG(zend_constants), (apply_func_t)const_to_unicode TSRMLS_CC);
+               EG(zend_constants)->pDestructor = ZEND_U_CONSTANT_DTOR;
 
                ucnv_close(UG(runtime_encoding_conv));
                UG(runtime_encoding_conv) = old_runtime_encoding_conv;
        }
+}
 
+/* Unlink the global (r/o) copies of the class, function and constant tables,
+ * and use a fresh r/w copy for the startup thread
+ */
+void zend_post_startup(TSRMLS_D)
+{
 #ifdef ZTS
+       zend_compiler_globals *compiler_globals = ts_resource(compiler_globals_id);
+       zend_executor_globals *executor_globals = ts_resource(executor_globals_id);
+
+       *GLOBAL_FUNCTION_TABLE = *compiler_globals->function_table;
+       *GLOBAL_CLASS_TABLE = *compiler_globals->class_table;
+       *GLOBAL_CONSTANTS_TABLE = *executor_globals->zend_constants;
        zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
        free(compiler_globals->function_table);
        free(compiler_globals->class_table);
index 8f8d0a99c89820476a6519ee9ce5e2094cb53a40..d013bf0a51fe66459c5fb9780b669db61541444a 100644 (file)
@@ -1940,8 +1940,8 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
        zend_function *ctor = NULL, *dtor = NULL, *clone = NULL, *__get = NULL, *__set = NULL, *__unset = NULL, *__isset = NULL, *__call = NULL, *__tostring = NULL;
        char *lowercase_name;
        int fname_len;
-       char *lc_class_name = NULL;
-       int class_name_len = 0;
+       zstr lc_class_name = NULL_ZSTR;
+       unsigned int lc_class_name_len = 0;
 
        if (type==MODULE_PERSISTENT) {
                error_type = E_CORE_WARNING;
@@ -1956,17 +1956,44 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
        internal_function->module = EG(current_module);
 
        if (scope) {
-               class_name_len = scope->name_length;
-               lc_class_name = zend_str_tolower_dup(scope->name.s, class_name_len);
+               lc_class_name = zend_u_str_case_fold(ZEND_STR_TYPE, scope->name, scope->name_length, 0, &lc_class_name_len);
        }
 
        while (ptr->fname) {
                internal_function->handler = ptr->handler;
-               internal_function->function_name.s = ptr->fname;
+               if (UG(unicode)) {
+                       int len = strlen(ptr->fname)+1;
+
+                       internal_function->function_name.u = malloc(UBYTES(len));
+                       u_charsToUChars(ptr->fname, internal_function->function_name.u, len);
+               } else {
+                       internal_function->function_name.s = ptr->fname;
+               }
                internal_function->scope = scope;
                internal_function->prototype = NULL;
                if (ptr->arg_info) {
-                       internal_function->arg_info = ptr->arg_info+1;
+                       if (UG(unicode)) {
+                               zend_arg_info *args;
+                               int n = ptr->num_args;
+                               
+                               args = internal_function->arg_info = malloc((n + 1) * sizeof(zend_arg_info));
+                               memcpy(args, ptr->arg_info+1, (n + 1) * sizeof(zend_arg_info));
+                               while (n > 0) {
+                                       --n;
+                                       if (args[n].name.s) {
+                                               UChar *uname = malloc(UBYTES(args[n].name_len + 1));
+                                               u_charsToUChars(args[n].name.s, uname, args[n].name_len+1);
+                                               args[n].name.u = uname;
+                                       }
+                                       if (args[n].class_name.s) {
+                                               UChar *uname = malloc(UBYTES(args[n].class_name_len + 1));
+                                               u_charsToUChars(args[n].class_name.s, uname, args[n].class_name_len+1);
+                                               args[n].class_name.u = uname;
+                                       }
+                               }
+                       } else {
+                               internal_function->arg_info = ptr->arg_info+1;
+                       }
                        internal_function->num_args = ptr->num_args;
                        /* Currently you cannot denote that the function can accept less arguments than num_args */
                        if (ptr->arg_info[0].required_num_args == -1) {
@@ -1986,7 +2013,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
                if (ptr->flags) {
                        if (!(ptr->flags & ZEND_ACC_PPP_MASK)) {
                                if (ptr->flags != ZEND_ACC_DEPRECATED || scope) {
-                                       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);
+                                       zend_error(error_type, "Invalid access level for %v%s%s() - access must be exactly one of public, protected or private", scope ? scope->name : EMPTY_ZSTR, scope ? "::" : "", ptr->fname);
                                }
                                internal_function->fn_flags = ZEND_ACC_PUBLIC | ptr->flags;
                        } else {
@@ -2007,19 +2034,19 @@ 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.s : "", scope ? "::" : "", ptr->fname);
+                               zend_error(error_type, "Static function %v%s%s() cannot be abstract", scope ? scope->name : EMPTY_ZSTR, scope ? "::" : "", ptr->fname);
                        }
                } else {
                        if (scope && (scope->ce_flags & ZEND_ACC_INTERFACE)) {
-                               efree(lc_class_name);
-                               zend_error(error_type, "Interface %s cannot contain non abstract method %s()", scope->name, ptr->fname);
+                               efree(lc_class_name.v);
+                               zend_error(error_type, "Interface %v cannot contain non abstract method %s()", scope->name, ptr->fname);
                                return FAILURE;
                        }
                        if (!internal_function->handler) {
                                if (scope) {
-                                       efree(lc_class_name);
+                                       efree(lc_class_name.v);
                                }
-                               zend_error(error_type, "Method %s%s%s() cannot be a NULL function", scope ? scope->name.s : "", scope ? "::" : "", ptr->fname);
+                               zend_error(error_type, "Method %v%s%s() cannot be a NULL function", scope ? scope->name : EMPTY_ZSTR, scope ? "::" : "", ptr->fname);
                                zend_unregister_functions(functions, count, target_function_table TSRMLS_CC);
                                return FAILURE;
                        }
@@ -2027,7 +2054,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
                fname_len = strlen(ptr->fname);
                lowercase_name = do_alloca(fname_len+1);
                zend_str_tolower_copy(lowercase_name, ptr->fname, fname_len);
-               if (zend_hash_add(target_function_table, lowercase_name, fname_len+1, &function, sizeof(zend_function), (void**)&reg_function) == FAILURE) {
+               if (zend_ascii_hash_add(target_function_table, lowercase_name, fname_len+1, &function, sizeof(zend_function), (void**)&reg_function) == FAILURE) {
                        unload=1;
                        free_alloca(lowercase_name);
                        break;
@@ -2037,14 +2064,17 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
                         * If it's an old-style constructor, store it only if we don't have
                         * a constructor already.
                         */
-                       if ((fname_len == class_name_len) && !memcmp(lowercase_name, lc_class_name, class_name_len+1) && !ctor) {
+                       unsigned int lc_func_name_len;
+                       zstr lc_func_name = zend_u_str_case_fold(ZEND_STR_TYPE, internal_function->function_name, fname_len, 0, &lc_func_name_len);
+                       
+                       if ((lc_func_name_len == lc_class_name_len) && !memcmp(lc_func_name.v, lc_class_name.v, UG(unicode)?UBYTES(lc_class_name_len):lc_class_name_len) && !ctor) {
                                ctor = reg_function;
                        } else if ((fname_len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME))) {
                                ctor = reg_function;
                        } else if ((fname_len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_DESTRUCTOR_FUNC_NAME, sizeof(ZEND_DESTRUCTOR_FUNC_NAME))) {
                                dtor = reg_function;
                                if (internal_function->num_args) {
-                                       zend_error(error_type, "Destructor %s::%s() cannot take arguments", scope->name, ptr->fname);
+                                       zend_error(error_type, "Destructor %v::%s() cannot take arguments", scope->name, ptr->fname);
                                }
                        } else if ((fname_len == sizeof(ZEND_CLONE_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME))) {
                                clone = reg_function;
@@ -2073,11 +2103,11 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
        }
        if (unload) { /* before unloading, display all remaining bad function in the module */
                if (scope) {
-                       free_alloca(lc_class_name);
+                       free_alloca(lc_class_name.v);
                }
                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.s : "", scope ? "::" : "", ptr->fname);
+                               zend_error(error_type, "Function registration failed - duplicate name - %v%s%s", scope ? scope->name : EMPTY_ZSTR, scope ? "::" : "", ptr->fname);
                        }
                        ptr++;
                }
@@ -2097,61 +2127,61 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
                if (ctor) {
                        ctor->common.fn_flags |= ZEND_ACC_CTOR;
                        if (ctor->common.fn_flags & ZEND_ACC_STATIC) {
-                               zend_error(error_type, "Constructor %s::%s() cannot be static", scope->name, ctor->common.function_name);
+                               zend_error(error_type, "Constructor %v::%v() cannot be static", scope->name, ctor->common.function_name);
                        }
                        ctor->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
                }
                if (dtor) {
                        dtor->common.fn_flags |= ZEND_ACC_DTOR;
                        if (dtor->common.fn_flags & ZEND_ACC_STATIC) {
-                               zend_error(error_type, "Destructor %s::%s() cannot be static", scope->name, dtor->common.function_name);
+                               zend_error(error_type, "Destructor %v::%v() cannot be static", scope->name, dtor->common.function_name);
                        }
                        dtor->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
                }
                if (clone) {
                        clone->common.fn_flags |= ZEND_ACC_CLONE;
                        if (clone->common.fn_flags & ZEND_ACC_STATIC) {
-                               zend_error(error_type, "Constructor %s::%s() cannot be static", scope->name, clone->common.function_name);
+                               zend_error(error_type, "Constructor %v::%v() cannot be static", scope->name, clone->common.function_name);
                        }
                        clone->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
                }
                if (__call) {
                        if (__call->common.fn_flags & ZEND_ACC_STATIC) {
-                               zend_error(error_type, "Method %s::%s() cannot be static", scope->name, __call->common.function_name);
+                               zend_error(error_type, "Method %v::%v() cannot be static", scope->name, __call->common.function_name);
                        }
                        __call->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
                }
                if (__tostring) {
                        if (__tostring->common.fn_flags & ZEND_ACC_STATIC) {
-                               zend_error(error_type, "Method %s::%s() cannot be static", scope->name, __tostring->common.function_name);
+                               zend_error(error_type, "Method %v::%v() cannot be static", scope->name, __tostring->common.function_name);
                        }
                        __tostring->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
                }
                if (__get) {
                        if (__get->common.fn_flags & ZEND_ACC_STATIC) {
-                               zend_error(error_type, "Method %s::%s() cannot be static", scope->name, __get->common.function_name);
+                               zend_error(error_type, "Method %v::%v() cannot be static", scope->name, __get->common.function_name);
                        }
                        __get->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
                }
                if (__set) {
                        if (__set->common.fn_flags & ZEND_ACC_STATIC) {
-                               zend_error(error_type, "Method %s::%s() cannot be static", scope->name, __set->common.function_name);
+                               zend_error(error_type, "Method %v::%v() cannot be static", scope->name, __set->common.function_name);
                        }
                        __set->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
                }
                if (__unset) {
                        if (__unset->common.fn_flags & ZEND_ACC_STATIC) {
-                               zend_error(error_type, "Method %s::%s() cannot be static", scope->name, __unset->common.function_name);
+                               zend_error(error_type, "Method %v::%v() cannot be static", scope->name, __unset->common.function_name);
                        }
                        __unset->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
                }
                if (__isset) {
                        if (__isset->common.fn_flags & ZEND_ACC_STATIC) {
-                               zend_error(error_type, "Method %s::%s() cannot be static", scope->name, __isset->common.function_name);
+                               zend_error(error_type, "Method %v::%v() cannot be static", scope->name, __isset->common.function_name);
                        }
                        __isset->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
                }
-               efree(lc_class_name);
+               efree(lc_class_name.v);
        }
        return SUCCESS;
 }
@@ -2175,7 +2205,7 @@ ZEND_API void zend_unregister_functions(zend_function_entry *functions, int coun
 #if 0
                zend_printf("Unregistering %s()\n", ptr->fname);
 #endif
-               zend_hash_del(target_function_table, ptr->fname, strlen(ptr->fname)+1);
+               zend_ascii_hash_del(target_function_table, ptr->fname, strlen(ptr->fname)+1);
                ptr++;
                i++;
        }
@@ -2288,7 +2318,9 @@ int zend_next_free_module(void)
 static zend_class_entry *do_register_internal_class(zend_class_entry *orig_class_entry, zend_uint ce_flags TSRMLS_DC)
 {
        zend_class_entry *class_entry = malloc(sizeof(zend_class_entry));
-       char *lowercase_name = malloc(orig_class_entry->name_length + 1);
+       zstr lcname;
+       unsigned int lcname_len;
+
        *class_entry = *orig_class_entry;
 
        class_entry->type = ZEND_INTERNAL_CLASS;
@@ -2300,9 +2332,9 @@ 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.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);
+       lcname = zend_u_str_case_fold(ZEND_STR_TYPE, class_entry->name, class_entry->name_length, 0, &lcname_len);
+       zend_u_hash_update(CG(class_table), ZEND_STR_TYPE, lcname, lcname_len+1, &class_entry, sizeof(zend_class_entry *), NULL);
+       efree(lcname.v);
        return class_entry;
 }
 
@@ -2317,7 +2349,7 @@ ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *cla
 
        if (!parent_ce && parent_name) {
                zend_class_entry **pce;
-               if (zend_hash_find(CG(class_table), parent_name, strlen(parent_name)+1, (void **) &pce)==FAILURE) {
+               if (zend_ascii_hash_find(CG(class_table), parent_name, strlen(parent_name)+1, (void **) &pce)==FAILURE) {
                        return NULL;
                } else {
                        parent_ce = *pce;
@@ -2979,7 +3011,18 @@ ZEND_API int zend_u_declare_property_ex(zend_class_entry *ce, zend_uchar type, z
 
 ZEND_API int zend_declare_property_ex(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type, zstr doc_comment, int doc_comment_len TSRMLS_DC)
 {
-       return zend_u_declare_property_ex(ce, IS_STRING, ZSTR(name), name_length, property, access_type, doc_comment, doc_comment_len TSRMLS_CC);
+       if (UG(unicode)) {
+               zstr uname;
+               int ret;
+
+               uname.u = do_alloca(name_length+1);
+               u_charsToUChars(name, uname.u, name_length+1);
+               ret = zend_u_declare_property_ex(ce, IS_UNICODE, uname, name_length, property, access_type, doc_comment, doc_comment_len TSRMLS_CC);
+               free_alloca(uname.u);
+               return ret;
+       } else {
+               return zend_u_declare_property_ex(ce, IS_STRING, ZSTR(name), name_length, property, access_type, doc_comment, doc_comment_len TSRMLS_CC);
+       }
 }
 
 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)
@@ -2989,7 +3032,18 @@ ZEND_API int zend_u_declare_property(zend_class_entry *ce, zend_uchar type, zstr
 
 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, ZSTR(name), name_length, property, access_type, NULL_ZSTR, 0 TSRMLS_CC);
+       if (UG(unicode)) {
+               zstr uname;
+               int ret;
+
+               uname.u = do_alloca(name_length+1);
+               u_charsToUChars(name, uname.u, name_length+1);
+               ret = zend_u_declare_property_ex(ce, IS_UNICODE, uname, name_length, property, access_type, NULL_ZSTR, 0 TSRMLS_CC);
+               free_alloca(uname.u);
+               return ret;
+       } else {
+               return zend_u_declare_property_ex(ce, IS_STRING, ZSTR(name), name_length, property, access_type, NULL_ZSTR, 0 TSRMLS_CC);
+       }
 }
 
 ZEND_API int zend_declare_property_null(zend_class_entry *ce, char *name, int name_length, int access_type TSRMLS_DC)
@@ -3054,10 +3108,17 @@ ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int
 
        if (ce->type & ZEND_INTERNAL_CLASS) {
                property = malloc(sizeof(zval));
-               ZVAL_STRINGL(property, zend_strndup(value, len), len, 0);
+               if (UG(unicode)) {
+                       Z_TYPE_P(property) = IS_UNICODE;
+                       Z_USTRVAL_P(property) = malloc(UBYTES(len+1));
+                       u_charsToUChars(value, Z_USTRVAL_P(property), len+1);
+                       Z_USTRLEN_P(property) = len;
+               } else {
+                       ZVAL_STRINGL(property, zend_strndup(value, len), len, 0);
+               }
        } else {
                ALLOC_ZVAL(property);
-               ZVAL_STRINGL(property, value, len, 1);
+               ZVAL_ASCII_STRINGL(property, value, len, 1);
        }
        INIT_PZVAL(property);
        return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC);
@@ -3069,10 +3130,17 @@ ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, char *name, int
 
        if (ce->type & ZEND_INTERNAL_CLASS) {
                property = malloc(sizeof(zval));
-               ZVAL_STRINGL(property, zend_strndup(value, value_len), value_len, 0);
+               if (UG(unicode)) {
+                       Z_TYPE_P(property) = IS_UNICODE;
+                       Z_USTRVAL_P(property) = malloc(UBYTES(value_len+1));
+                       u_charsToUChars(value, Z_USTRVAL_P(property), value_len+1);
+                       Z_USTRLEN_P(property) = value_len;
+               } else {
+                       ZVAL_STRINGL(property, zend_strndup(value, value_len), value_len, 0);
+               }
        } else {
                ALLOC_ZVAL(property);
-               ZVAL_STRINGL(property, value, value_len, 1);
+               ZVAL_ASCII_STRINGL(property, value, value_len, 1);
        }
        INIT_PZVAL(property);
        return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC);
@@ -3080,7 +3148,7 @@ ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, char *name, int
 
 ZEND_API int zend_declare_class_constant(zend_class_entry *ce, char *name, size_t name_length, zval *value TSRMLS_DC)
 {
-       return zend_hash_update(&ce->constants_table, name, name_length+1, &value, sizeof(zval *), NULL);
+       return zend_ascii_hash_update(&ce->constants_table, name, name_length+1, &value, sizeof(zval *), NULL);
 }
 
 ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, char *name, size_t name_length TSRMLS_DC)
@@ -3143,12 +3211,19 @@ ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, char *nam
 {
        zval *constant;
 
-       if (ce->type & ZEND_INTERNAL_CLASS) {
+       if (ce->type & ZEND_INTERNAL_CLASS) {           
                constant = malloc(sizeof(zval));
-               ZVAL_STRINGL(constant, zend_strndup(value, value_length), value_length, 0);
+               if (UG(unicode)) {
+                       Z_TYPE_P(constant) = IS_UNICODE;
+                       Z_USTRVAL_P(constant) = malloc(UBYTES(value_length+1));
+                       u_charsToUChars(value, Z_USTRVAL_P(constant), value_length+1);
+                       Z_USTRLEN_P(constant) = value_length;
+               } else {
+                       ZVAL_STRINGL(constant, zend_strndup(value, value_length), value_length, 0);
+               }
        } else {
                ALLOC_ZVAL(constant);
-               ZVAL_STRINGL(constant, value, value_length, 1);
+               ZVAL_ASCII_STRINGL(constant, value, value_length, 1);
        }
        INIT_PZVAL(constant);
        return zend_declare_class_constant(ce, name, name_length, constant TSRMLS_CC);
index 9333a4225a3739e057817983ceb7089ae67ad6cc..adcef2c0279a74938e2bb51e4e1b45055e260133 100644 (file)
@@ -121,12 +121,22 @@ typedef struct _zend_function_entry {
 
 #endif
 
-#define INIT_CLASS_ENTRY(class_container, class_name, functions) INIT_OVERLOADED_CLASS_ENTRY(class_container, class_name, functions, NULL, NULL, NULL)
+#define INIT_CLASS_ENTRY(class_container, class_name, functions) \
+       INIT_OVERLOADED_CLASS_ENTRY(class_container, class_name, functions, NULL, NULL, NULL)
 
-#define INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, functions, handle_fcall, handle_propget, handle_propset, handle_propunset, handle_propisset) \
+#define INIT_CLASS_ENTRY_EX(class_container, class_name, class_name_len, functions) \
+       INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, class_name_len, functions, NULL, NULL, NULL, NULL, NULL)
+
+#define INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, class_name_len, functions, handle_fcall, handle_propget, handle_propset, handle_propunset, handle_propisset) \
        {                                                                                                                       \
-               class_container.name.s = strdup(class_name);                    \
-               class_container.name_length = sizeof(class_name) - 1;   \
+               int _len = class_name_len;                                                              \
+               if (UG(unicode)) {                                                                              \
+                       class_container.name.u = malloc(UBYTES(_len+1));                                \
+                       u_charsToUChars(class_name, class_container.name.u, _len+1);    \
+               } else {                                                                                                                        \
+                       class_container.name.s = zend_strndup(class_name, _len);                \
+               }                                                                                                               \
+               class_container.name_length = _len;                                     \
                class_container.builtin_functions = functions;                  \
                class_container.constructor = NULL;                                             \
                class_container.destructor = NULL;                                              \
@@ -154,7 +164,7 @@ typedef struct _zend_function_entry {
        }
 
 #define INIT_OVERLOADED_CLASS_ENTRY(class_container, class_name, functions, handle_fcall, handle_propget, handle_propset) \
-       INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, functions, handle_fcall, handle_propget, handle_propset, NULL, NULL)
+       INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, sizeof(class_name)-1, functions, handle_fcall, handle_propget, handle_propset, NULL, NULL)
 
 #ifdef ZTS
 #      define CE_STATIC_MEMBERS(ce) (((ce)->type==ZEND_USER_CLASS)?(ce)->static_members:CG(static_members)[(long)(ce)->static_members])
index 823acaa3c94446c09bb64722ec71f2e6d85eea78..65214628855fb2647ddf8fd03032a9d196c90d5a 100644 (file)
@@ -1919,13 +1919,32 @@ ZEND_API void function_add_ref(zend_function *function TSRMLS_DC)
                        zend_u_hash_init(op_array->static_variables, zend_hash_num_elements(static_variables), NULL, ZVAL_PTR_DTOR, 0, UG(unicode));
                        zend_hash_copy(op_array->static_variables, static_variables, (copy_ctor_func_t) zval_add_ref, (void *) &tmp_zval, sizeof(zval *));
                }
+       } else if (UG(unicode) && function->type == ZEND_INTERNAL_FUNCTION) {
+               zend_internal_function *func = &function->internal_function;
+
+               func->function_name.u = zend_ustrndup(func->function_name.u, u_strlen(func->function_name.u));
+               if (func->arg_info) {
+                       zend_arg_info *args;
+                       int n = func->num_args;
+
+                       args = malloc((n + 1) * sizeof(zend_arg_info));
+                       memcpy(args, func->arg_info, (n + 1) * sizeof(zend_arg_info));
+                       while (n > 0) {
+                               --n;
+                               if (args[n].name.u) {
+                                       args[n].name.u = zend_ustrndup(args[n].name.u, u_strlen(args[n].name.u));
+                               }
+                               if (args[n].class_name.s) {
+                                       args[n].class_name.u = zend_ustrndup(args[n].class_name.u, u_strlen(args[n].class_name.u));
+                               }
+                       }
+                       func->arg_info = args;
+               }
        }
 }
 
 static void do_inherit_parent_constructor(zend_class_entry *ce TSRMLS_DC)
 {
-       zend_function *function;
-
        if (!ce->parent) {
                return;
        }
@@ -1978,34 +1997,17 @@ static void do_inherit_parent_constructor(zend_class_entry *ce TSRMLS_DC)
                                );
                }
                return;
-       }
-
-       if (zend_hash_find(&ce->parent->function_table, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME), (void **)&function)==SUCCESS) {
-               /* inherit parent's constructor */
-               zend_hash_update(&ce->function_table, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME), function, sizeof(zend_function), NULL);
-               function_add_ref(function TSRMLS_CC);
-       } 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;
-               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);
-                       if (!zend_u_hash_exists(&ce->function_table, utype, lc_class_name, lc_class_name_len+1)) {
-                               lc_parent_class_name = zend_u_str_case_fold(utype, ce->parent->name, ce->parent->name_length, 0, &lc_parent_class_name_len);
-                               if (zend_u_hash_find(&ce->parent->function_table, utype, lc_parent_class_name, lc_parent_class_name_len+1, (void **)&function)==SUCCESS) {
-                               if (function->common.fn_flags & ZEND_ACC_CTOR) {
-                                       /* inherit parent's constructor */
-                                       zend_u_hash_update(&ce->function_table, utype, lc_class_name, lc_class_name_len+1, function, sizeof(zend_function), NULL);
-                                       function_add_ref(function TSRMLS_CC);
-                               }
-                       }
-                       efree(lc_parent_class_name.v);
+       } else if (ce->parent->constructor) {
+               ce->constructor = ce->parent->constructor;
+               if (!zend_ascii_hash_exists(&ce->function_table, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME))) {
+                       unsigned int lc_class_name_len;
+                       zstr lc_class_name = zend_u_str_case_fold(ZEND_STR_TYPE, ce->name, ce->name_length, 0, &lc_class_name_len);
+
+                       zend_u_hash_update(&ce->function_table, ZEND_STR_TYPE, lc_class_name, lc_class_name_len+1, ce->constructor, sizeof(zend_function), NULL);
+                       function_add_ref(ce->constructor TSRMLS_CC);
+                       efree(lc_class_name.v);
                }
-               efree(lc_class_name.v);
        }
-       ce->constructor = ce->parent->constructor;
 }
 
 
@@ -4347,7 +4349,7 @@ ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify
        zend_u_hash_init_ex(&ce->properties_info, 0, NULL, (dtor_func_t) (persistent_hashes ? zend_destroy_property_info_internal : zend_destroy_property_info), persistent_hashes, UG(unicode), 0);
        zend_u_hash_init_ex(&ce->default_static_members, 0, NULL, zval_ptr_dtor_func, persistent_hashes, UG(unicode), 0);
        zend_u_hash_init_ex(&ce->constants_table, 0, NULL, zval_ptr_dtor_func, persistent_hashes, UG(unicode), 0);
-       zend_u_hash_init_ex(&ce->function_table, 0, NULL, ZEND_FUNCTION_DTOR, persistent_hashes, UG(unicode), 0);
+       zend_u_hash_init_ex(&ce->function_table, 0, NULL, UG(unicode)?ZEND_U_FUNCTION_DTOR:ZEND_FUNCTION_DTOR, persistent_hashes, UG(unicode), 0);
 
        if (ce->type == ZEND_INTERNAL_CLASS) {
 #ifdef ZTS
index f63e3174e3a29846d0e385e47ab31bf0ef0d4cfc..ac54f67bb4ebf4cd9eb81075073eba4d9eadd7ec 100644 (file)
@@ -545,6 +545,7 @@ ZEND_API int zend_copy_scanner_string(zval *zendlval, char *str, zend_uint str_l
 
 ZEND_API void destroy_zend_function(zend_function *function TSRMLS_DC);
 ZEND_API void zend_function_dtor(zend_function *function);
+ZEND_API void zend_u_function_dtor(zend_function *function);
 ZEND_API void destroy_zend_class(zend_class_entry **pce);
 void zend_class_add_ref(zend_class_entry **ce);
 
@@ -556,6 +557,7 @@ ZEND_API int zend_u_unmangle_property_name(zend_uchar type, zstr mangled_propert
 
 
 #define ZEND_FUNCTION_DTOR (void (*)(void *)) zend_function_dtor
+#define ZEND_U_FUNCTION_DTOR (void (*)(void *)) zend_u_function_dtor
 #define ZEND_CLASS_DTOR (void (*)(void *)) destroy_zend_class
 
 zend_op *get_next_op(zend_op_array *op_array TSRMLS_DC);
index eac88543c05e2ffafd1f6f1395759f99cf1e963e..5657a4c6acae14a918e6ed6ab96b007abc790b70 100644 (file)
@@ -186,13 +186,19 @@ ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval,
 {
        zend_constant c;
 
+       if (UG(unicode)) {
+               c.name.u = malloc(UBYTES(name_len));
+               u_charsToUChars(name, c.name.u, name_len);
+               c.name_len = name_len;
+       } else {
+               c.name.s = zend_strndup(name, name_len-1);
+               c.name_len = name_len;
+       }
        Z_TYPE(c.value) = IS_LONG;
        Z_LVAL(c.value) = lval;
        c.flags = flags;
-       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);
+       zend_u_register_constant(ZEND_STR_TYPE, &c TSRMLS_CC);
 }
 
 
@@ -200,13 +206,19 @@ ZEND_API void zend_register_double_constant(char *name, uint name_len, double dv
 {
        zend_constant c;
 
+       if (UG(unicode)) {
+               c.name.u = malloc(UBYTES(name_len));
+               u_charsToUChars(name, c.name.u, name_len);
+               c.name_len = name_len;
+       } else {
+               c.name.s = zend_strndup(name, name_len-1);
+               c.name_len = name_len;
+       }
        Z_TYPE(c.value) = IS_DOUBLE;
        Z_DVAL(c.value) = dval;
        c.flags = flags;
-       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);
+       zend_u_register_constant(ZEND_STR_TYPE, &c TSRMLS_CC);
 }
 
 
@@ -214,14 +226,31 @@ ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *st
 {
        zend_constant c;
 
-       Z_TYPE(c.value) = IS_STRING;
-       Z_STRVAL(c.value) = strval;
-       Z_STRLEN(c.value) = strlen;
+       if (UG(unicode)) {
+               c.name.u = malloc(UBYTES(name_len));
+               u_charsToUChars(name, c.name.u, name_len);
+               c.name_len = name_len;
+               Z_TYPE(c.value) = IS_UNICODE;
+               if (flags & CONST_PERSISTENT) {
+                       Z_USTRVAL(c.value) = malloc(UBYTES(strlen+1));
+               } else {
+                       Z_USTRVAL(c.value) = emalloc(UBYTES(strlen+1));
+               }
+               u_charsToUChars(strval, Z_USTRVAL(c.value), strlen+1);
+               Z_USTRLEN(c.value) = strlen;
+               if (!(flags & CONST_PERSISTENT)) {
+                       efree(strval);
+               }
+       } else {
+               c.name.s = zend_strndup(name, name_len-1);
+               c.name_len = name_len;
+               Z_TYPE(c.value) = IS_STRING;
+               Z_STRVAL(c.value) = strval;
+               Z_STRLEN(c.value) = strlen;
+       }
        c.flags = flags;
-       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);
+       zend_u_register_constant(ZEND_STR_TYPE, &c TSRMLS_CC);
 }
 
 
index e0e22be46fd41d245588b002e7811513629bf0bd..62d87f7f32c43de2adc59e9f549df096c5ee02c8 100644 (file)
@@ -124,6 +124,32 @@ ZEND_API void zend_function_dtor(zend_function *function)
        destroy_zend_function(function TSRMLS_CC);
 }
 
+ZEND_API void zend_u_function_dtor(zend_function *function)
+{
+       TSRMLS_FETCH();
+
+       destroy_zend_function(function TSRMLS_CC);
+       if (function->type == ZEND_INTERNAL_FUNCTION) {
+               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.v) {
+                                       free(function->common.arg_info[n].name.v);
+                               }
+                               if (function->common.arg_info[n].class_name.v) {
+                                       free(function->common.arg_info[n].class_name.v);
+                               }
+                       }
+                       free(function->common.arg_info);
+               }
+       }
+}
+
 static void zend_cleanup_op_array_data(zend_op_array *op_array)
 {
        if (op_array->static_variables) {
index efe659f617d0edd00fcaf924da03bee97c2a6004..fc8be987825ef765fac1e38ba4bb376f16c2ec46 100644 (file)
@@ -71,7 +71,6 @@ zend_class_entry *dom_namespace_node_class_entry;
 zend_object_handlers dom_object_handlers;
 
 static HashTable classes;
-static HashTable u_classes;
 
 typedef int (*dom_read_t)(dom_object *obj, zval **retval TSRMLS_DC);
 typedef int (*dom_write_t)(dom_object *obj, zval *newval TSRMLS_DC);
@@ -248,7 +247,7 @@ static void dom_register_prop_handler(HashTable *prop_handler, char *name, dom_r
        
        hnd.read_func = read_func ? read_func : dom_read_na;
        hnd.write_func = write_func ? write_func : dom_write_na;
-       zend_hash_add(prop_handler, name, strlen(name)+1, &hnd, sizeof(dom_prop_handler), NULL);
+       zend_ascii_hash_add(prop_handler, name, strlen(name)+1, &hnd, sizeof(dom_prop_handler), NULL);
 }
 /* }}} */
 
@@ -506,14 +505,6 @@ static void dom_prop_handlers_dtor(HashTable *ht)
        zend_hash_destroy(ht);
 }
 
-static void dom_prop_handlers_ctor(HashTable *ht)
-{
-       HashTable tmp = *ht;
-
-       zend_u_hash_init(ht, 0, NULL, NULL, 1, 1);
-       zend_hash_copy(ht, &tmp, NULL, NULL, sizeof(dom_prop_handler));
-}
-
 /* {{{ PHP_MINIT_FUNCTION(dom) */
 PHP_MINIT_FUNCTION(dom)
 {
@@ -563,19 +554,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.s, ce.name_length + 1, &dom_domstringlist_prop_handlers, sizeof(dom_domstringlist_prop_handlers), NULL);
+       zend_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, 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.s, ce.name_length + 1, &dom_namelist_prop_handlers, sizeof(dom_namelist_prop_handlers), NULL);
+       zend_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, 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.s, ce.name_length + 1, &dom_domimplementationlist_prop_handlers, sizeof(dom_domimplementationlist_prop_handlers), NULL);
+       zend_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, 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);
@@ -599,7 +590,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.s, ce.name_length + 1, &dom_node_prop_handlers, sizeof(dom_node_prop_handlers), NULL);
+       zend_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, 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);
 
@@ -612,12 +603,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.s, ce.name_length + 1, &dom_namespace_node_prop_handlers, sizeof(dom_namespace_node_prop_handlers), NULL);
+       zend_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, 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.s, ce.name_length + 1, &dom_document_fragment_prop_handlers, sizeof(dom_node_prop_handlers), NULL);
+       zend_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, 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);
@@ -642,7 +633,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.s, ce.name_length + 1, &dom_document_prop_handlers, sizeof(dom_document_prop_handlers), NULL);
+       zend_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, 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;
@@ -651,7 +642,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.s, ce.name_length + 1, &dom_nodelist_prop_handlers, sizeof(dom_nodelist_prop_handlers), NULL);
+       zend_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, 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;
@@ -660,7 +651,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.s, ce.name_length + 1, &dom_namednodemap_prop_handlers, sizeof(dom_namednodemap_prop_handlers), NULL);
+       zend_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, 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);
        
@@ -668,7 +659,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.s, ce.name_length + 1, &dom_characterdata_prop_handlers, sizeof(dom_characterdata_prop_handlers), NULL);
+       zend_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, 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);
        
@@ -679,7 +670,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.s, ce.name_length + 1, &dom_attr_prop_handlers, sizeof(dom_attr_prop_handlers), NULL);
+       zend_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, 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);
        
@@ -687,26 +678,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.s, ce.name_length + 1, &dom_element_prop_handlers, sizeof(dom_element_prop_handlers), NULL);
+       zend_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, 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.s, ce.name_length + 1, &dom_text_prop_handlers, sizeof(dom_text_prop_handlers), NULL);
+       zend_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, 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_characterdata_prop_handlers, NULL, NULL, sizeof(dom_prop_handler));
-       zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_comment_prop_handlers, sizeof(dom_comment_prop_handlers), NULL);
+       zend_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, ce.name_length + 1, &dom_comment_prop_handlers, sizeof(dom_comment_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.s, ce.name_length + 1, &dom_typeinfo_prop_handlers, sizeof(dom_typeinfo_prop_handlers), NULL);
+       zend_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, 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);
@@ -718,7 +709,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.s, ce.name_length + 1, &dom_domerror_prop_handlers, sizeof(dom_domerror_prop_handlers), NULL);
+       zend_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, 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);
@@ -729,13 +720,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.s, ce.name_length + 1, &dom_domlocator_prop_handlers, sizeof(dom_domlocator_prop_handlers), NULL);
+       zend_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, 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.s, ce.name_length + 1, &dom_cdata_prop_handlers, sizeof(dom_documenttype_prop_handlers), NULL);
+       zend_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, 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);
        
@@ -747,7 +738,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.s, ce.name_length + 1, &dom_documenttype_prop_handlers, sizeof(dom_documenttype_prop_handlers), NULL);
+       zend_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, 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);
        
@@ -758,7 +749,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.s, ce.name_length + 1, &dom_notation_prop_handlers, sizeof(dom_notation_prop_handlers), NULL);
+       zend_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, 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);
        
@@ -771,12 +762,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.s, ce.name_length + 1, &dom_entity_prop_handlers, sizeof(dom_entity_prop_handlers), NULL);
+       zend_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, 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.s, ce.name_length + 1, &dom_entity_reference_prop_handlers, sizeof(dom_entity_prop_handlers), NULL);
+       zend_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, 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);
        
@@ -784,7 +775,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.s, ce.name_length + 1, &dom_processinginstruction_prop_handlers, sizeof(dom_processinginstruction_prop_handlers), NULL);
+       zend_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, 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);
 
@@ -795,7 +786,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.s, ce.name_length + 1, &dom_xpath_prop_handlers, sizeof(dom_xpath_prop_handlers), NULL);
+       zend_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, 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);
@@ -851,9 +842,6 @@ PHP_MINIT_FUNCTION(dom)
 
        php_libxml_register_export(dom_node_class_entry, php_dom_export_node);
 
-       zend_u_hash_init(&u_classes, 0, NULL, (void (*)(void *))dom_prop_handlers_dtor, 1, 1);
-       zend_hash_copy(&u_classes, &classes, (copy_ctor_func_t)dom_prop_handlers_ctor, NULL, sizeof(HashTable));
-
        return SUCCESS;
 }
 /* }}} */
@@ -885,7 +873,6 @@ PHP_MINFO_FUNCTION(dom)
 PHP_MSHUTDOWN_FUNCTION(dom)
 {
        zend_hash_destroy(&classes);
-       zend_hash_destroy(&u_classes);
        
 /*     If you want do find memleaks in this module, compile libxml2 with --with-mem-debug and
        uncomment the following line, this will tell you the amount of not freed memory
@@ -1010,7 +997,7 @@ static dom_object* dom_objects_set_class(zend_class_entry *class_type, zend_bool
                base_class = base_class->parent;
        }
 
-       zend_u_hash_find(UG(unicode)?&u_classes:&classes, UG(unicode)?IS_UNICODE:IS_STRING, base_class->name, base_class->name_length + 1, (void **) &intern->prop_handler);
+       zend_u_hash_find(&classes, UG(unicode)?IS_UNICODE:IS_STRING, base_class->name, base_class->name_length + 1, (void **) &intern->prop_handler);
 
        zend_object_std_init(&intern->std, class_type TSRMLS_CC);
        if (hash_copy) {
index 70b3ce48ae4993247a23a7a151bcf820b0af3356..0f38184494ebdde26682f9f5703cace770d9ca54 100644 (file)
@@ -859,22 +859,13 @@ int php_libxml_xmlCheckUTF8(const unsigned char *s)
 int php_libxml_register_export(zend_class_entry *ce, php_libxml_export_node export_function)
 {
        php_libxml_func_handler export_hnd;
+       TSRMLS_FETCH();
        
        /* Initialize in case this module hasnt been loaded yet */
        php_libxml_initialize();
        export_hnd.export_func = export_function;
 
-       if (zend_hash_add(&php_libxml_exports, ce->name.s, ce->name_length + 1, &export_hnd, sizeof(export_hnd), NULL) == SUCCESS) {
-               int ret;
-               zstr name;
-
-               name.u = malloc(UBYTES(ce->name_length+1));
-               u_charsToUChars(ce->name.s, name.u, ce->name_length+1);
-               ret = zend_u_hash_add(&php_libxml_exports, IS_UNICODE, name, ce->name_length + 1, &export_hnd, sizeof(export_hnd), NULL);
-               free(name.u);
-               return ret;
-       }
-       return FAILURE;
+       return zend_u_hash_add(&php_libxml_exports, ZEND_STR_TYPE, ce->name, ce->name_length + 1, &export_hnd, sizeof(export_hnd), NULL);
 }
 
 PHP_LIBXML_API xmlNodePtr php_libxml_import_node(zval *object TSRMLS_DC)
index 231646cc85bc442516e098c84324421b984962ec..a688dd5635c189478754dcd70b2f47dc23726e4f 100755 (executable)
@@ -40,8 +40,7 @@ void spl_register_interface(zend_class_entry ** ppce, char * class_name, zend_fu
 {
        zend_class_entry ce;
        
-       INIT_CLASS_ENTRY(ce, class_name, functions);
-       ce.name_length = strlen(class_name);
+       INIT_CLASS_ENTRY_EX(ce, class_name, strlen(class_name), functions);
        *ppce = zend_register_internal_interface(&ce TSRMLS_CC);
 }
 /* }}} */
@@ -51,8 +50,7 @@ PHPAPI void spl_register_std_class(zend_class_entry ** ppce, char * class_name,
 {
        zend_class_entry ce;
        
-       INIT_CLASS_ENTRY(ce, class_name, function_list);
-       ce.name_length = strlen(class_name);
+       INIT_CLASS_ENTRY_EX(ce, class_name, strlen(class_name), function_list);
        *ppce = zend_register_internal_class(&ce TSRMLS_CC);
 
        /* entries changed by initialize */
@@ -67,8 +65,7 @@ PHPAPI void spl_register_sub_class(zend_class_entry ** ppce, zend_class_entry *
 {
        zend_class_entry ce;
        
-       INIT_CLASS_ENTRY(ce, class_name, function_list);
-       ce.name_length = strlen(class_name);
+       INIT_CLASS_ENTRY_EX(ce, class_name, strlen(class_name), function_list);
        *ppce = zend_register_internal_class_ex(&ce, parent_ce, NULL TSRMLS_CC);
 
        /* entries changed by initialize */
index 34461c56d53a2284ea6693cfa4251b89a13a293a..863372a0ea41157ef6ce4e1f81c6a37bd14e130c 100644 (file)
@@ -1512,7 +1512,6 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
        zend_utility_values zuv;
        int module_number=0;    /* for REGISTER_INI_ENTRIES() */
        char *php_os;
-       zend_bool orig_unicode;
 #ifdef ZTS
        zend_executor_globals *executor_globals;
        void ***tsrm_ls;
@@ -1650,9 +1649,6 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
        /* Register Zend ini entries */
        zend_register_standard_ini_entries(TSRMLS_C);
 
-       orig_unicode = UG(unicode);
-       UG(unicode) = 0;
-
        /* Disable realpath cache if open_basedir are set */
        if ((PG(open_basedir) && *PG(open_basedir))) {
                CWDG(realpath_cache_size_limit) = 0;
@@ -1752,7 +1748,6 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
                }
        }
 
-       UG(unicode) = orig_unicode;
        zend_post_startup(TSRMLS_C);
 
        module_initialized = 1;