diff options
88 files changed, 2046 insertions, 3359 deletions
diff --git a/Zend/zend.c b/Zend/zend.c index ac68702d70..6531c577e8 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -280,23 +280,19 @@ str_type: if (class_name.s[0]=='*') { ZEND_PUTS_EX(":protected"); } else { + UConverter *conv = ZEND_U_CONVERTER(UG(output_encoding_conv)); + UErrorCode status = U_ZERO_ERROR; + char *s = NULL; + int s_len; + ZEND_PUTS_EX(":"); - if (UG(unicode)) { - UConverter *conv = ZEND_U_CONVERTER(UG(output_encoding_conv)); - UErrorCode status = U_ZERO_ERROR; - char *s = NULL; - int s_len; - - zend_unicode_to_string_ex(conv, &s, &s_len, class_name.u, u_strlen(class_name.u), &status); - if (U_FAILURE(status)) { - zend_error(E_WARNING, "Could not convert Unicode to printable form"); - return; - } - ZEND_WRITE_EX(s, s_len); - efree(s); - } else { - ZEND_PUTS_EX(class_name.s); + zend_unicode_to_string_ex(conv, &s, &s_len, class_name.u, u_strlen(class_name.u), &status); + if (U_FAILURE(status)) { + zend_error(E_WARNING, "Could not convert Unicode to printable form"); + return; } + ZEND_WRITE_EX(s, s_len); + efree(s); ZEND_PUTS_EX(":private"); } } @@ -484,11 +480,7 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop default: *expr_copy = *expr; zval_copy_ctor(expr_copy); - if (UG(unicode)) { - convert_to_string_with_converter(expr_copy, ZEND_U_CONVERTER(UG(output_encoding_conv))); - } else { - convert_to_string(expr_copy); - } + convert_to_string_with_converter(expr_copy, ZEND_U_CONVERTER(UG(output_encoding_conv))); break; } Z_TYPE_P(expr_copy) = IS_STRING; @@ -651,22 +643,18 @@ ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int Z_OBJ_HANDLER_P(expr, get_class_name)(expr, &class_name, &clen, 0 TSRMLS_CC); } if (class_name.v) { - if (UG(unicode)) { - UConverter *conv = ZEND_U_CONVERTER(UG(output_encoding_conv)); - UErrorCode status = U_ZERO_ERROR; - char *s = NULL; - int s_len; - - zend_unicode_to_string_ex(conv, &s, &s_len, class_name.u, clen, &status); - if (U_FAILURE(status)) { - zend_error(E_WARNING, "Could not convert Unicode to printable form"); - return; - } - ZEND_WRITE_EX(s, s_len); - efree(s); - } else { - ZEND_PUTS_EX(class_name.s); + UConverter *conv = ZEND_U_CONVERTER(UG(output_encoding_conv)); + UErrorCode status = U_ZERO_ERROR; + char *s = NULL; + int s_len; + + zend_unicode_to_string_ex(conv, &s, &s_len, class_name.u, clen, &status); + if (U_FAILURE(status)) { + zend_error(E_WARNING, "Could not convert Unicode to printable form"); + return; } + ZEND_WRITE_EX(s, s_len); + efree(s); } else { ZEND_PUTS_EX("Unknown Class"); } @@ -756,7 +744,7 @@ static void zend_set_default_compile_time_values(TSRMLS_D) /* {{{ */ CG(asp_tags) = asp_tags_default; CG(short_tags) = short_tags_default; CG(compiler_options) = compiler_options_default; - CG(literal_type) = ZEND_STR_TYPE; + CG(literal_type) = IS_UNICODE; } /* }}} */ @@ -790,16 +778,7 @@ static void free_u_zend_constant(zend_constant *c) /* {{{ */ static void function_to_unicode(zend_function *func TSRMLS_DC) /* {{{ */ { if (func->common.function_name.s) { - if (UG(unicode)) { - func->common.function_name.u = zend_ustrdup(func->common.function_name.u); - } else { - UChar *uname; - int len = strlen(func->common.function_name.s) + 1; - - uname = malloc(UBYTES(len)); - u_charsToUChars(func->common.function_name.s, uname, len); - func->common.function_name.u = uname; - } + func->common.function_name.u = zend_ustrdup(func->common.function_name.u); } if (func->common.arg_info) { zend_arg_info *args; @@ -926,7 +905,7 @@ static void compiler_globals_ctor(zend_compiler_globals *compiler_globals TSRMLS zend_set_default_compile_time_values(TSRMLS_C); CG(interactive) = 0; - CG(literal_type) = ZEND_STR_TYPE; + CG(literal_type) = IS_UNICODE; compiler_globals->auto_globals = (HashTable *) malloc(sizeof(HashTable)); zend_u_hash_init_ex(compiler_globals->auto_globals, global_auto_globals_table->nNumOfElements, NULL, NULL, 1, UG(unicode), 0); @@ -1235,28 +1214,25 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions TS void zend_register_standard_ini_entries(TSRMLS_D) /* {{{ */ { int module_number = 0; - + UConverter *old_runtime_encoding_conv; + UErrorCode status = U_ZERO_ERROR; + REGISTER_INI_ENTRIES(); /* Make copies of HashTables with UNICODE */ + old_runtime_encoding_conv = UG(runtime_encoding_conv); + UG(runtime_encoding_conv) = ucnv_open("ASCII", &status); - if (UG(unicode)) { - UConverter *old_runtime_encoding_conv; - UErrorCode status = U_ZERO_ERROR; - - old_runtime_encoding_conv = UG(runtime_encoding_conv); - UG(runtime_encoding_conv) = ucnv_open("ASCII", &status); + 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; - 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; - ucnv_close(UG(runtime_encoding_conv)); - UG(runtime_encoding_conv) = old_runtime_encoding_conv; - } zend_startup_builtin_functions(TSRMLS_C); } /* }}} */ @@ -1631,7 +1607,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */ va_copy(usr_copy, args); Z_STRLEN_P(z_error_message) = zend_vspprintf(&Z_STRVAL_P(z_error_message), 0, format, usr_copy); Z_TYPE_P(z_error_message) = IS_STRING; - if (UG(unicode)) { + { char *str = Z_STRVAL_P(z_error_message); int len = Z_STRLEN_P(z_error_message); diff --git a/Zend/zend.h b/Zend/zend.h index 63e862b0dd..bb3d0f2879 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -583,7 +583,7 @@ typedef int (*zend_write_func_t)(const char *str, uint str_length); #define OE_IS_METHOD (1<<2) /* default engine string type */ -#define ZEND_STR_TYPE (UG(unicode) ? IS_UNICODE : IS_STRING) +#define ZEND_STR_TYPE IS_UNICODE int zend_startup(zend_utility_functions *utility_functions, char **extensions TSRMLS_DC); void zend_shutdown(TSRMLS_D); diff --git a/Zend/zend_API.c b/Zend/zend_API.c index cc2ae433fb..21461d3087 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -205,13 +205,7 @@ ZEND_API char *zend_get_type_by_const(int type) /* {{{ */ return "double"; case IS_STRING: { - TSRMLS_FETCH(); - - if (UG(unicode)) { - return "binary string"; - } else { - return "string"; - } + return "binary string"; } case IS_OBJECT: return "object"; @@ -344,7 +338,7 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **sp } if (c == 'x') { - c = UG(unicode) ? 'u' : 's'; + c = 'u'; } switch (c) { @@ -498,11 +492,7 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **sp case IS_ARRAY: case IS_RESOURCE: default: - if (UG(unicode)) { - return "binary string"; - } else { - return "string"; - } + return "binary string"; } } break; @@ -610,7 +600,7 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **sp if (return_null) { *p = NULL_ZSTR; *pl = 0; - *type = UG(unicode)?IS_UNICODE:IS_STRING; + *type = IS_UNICODE; break; } /* break omitted intentionally */ @@ -618,13 +608,8 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **sp case IS_LONG: case IS_DOUBLE: case IS_BOOL: - if (UG(unicode)) { - convert_to_unicode_ex(arg); - RETURN_AS_UNICODE(arg, p, pl, type); - } else { - convert_to_string_ex(arg); - RETURN_AS_STRING(arg, p, pl, type); - } + convert_to_unicode_ex(arg); + RETURN_AS_UNICODE(arg, p, pl, type); break; case IS_STRING: @@ -636,8 +621,8 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **sp break; case IS_OBJECT: - if (parse_arg_object_to_string(arg, (char**)p, pl, UG(unicode) ? IS_UNICODE : IS_STRING TSRMLS_CC) == SUCCESS) { - *type = UG(unicode)?IS_UNICODE:IS_STRING; + if (parse_arg_object_to_string(arg, (char**)p, pl, IS_UNICODE TSRMLS_CC) == SUCCESS) { + *type = IS_UNICODE; break; } @@ -751,7 +736,7 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **sp *p = *arg; } else { if (ce) { - *ret_type = UG(unicode)?IS_UNICODE:IS_STRING; + *ret_type = IS_UNICODE; return ce->name.v; } else { return "object"; @@ -769,7 +754,7 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **sp *pce = NULL; break; } - convert_to_text_ex(arg); + convert_to_unicode_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 { @@ -1029,7 +1014,7 @@ static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int fl } if (T_arg_type == -1) { - T_arg_type = ZEND_STR_TYPE; + T_arg_type = IS_UNICODE; } } @@ -2020,15 +2005,11 @@ ZEND_API void zend_check_magic_method_implementation(const zend_class_entry *ce, unsigned int lcname_len; zstr lcname; int name_len; - zend_uchar utype = UG(unicode)?IS_UNICODE:IS_STRING; + zend_uchar utype = IS_UNICODE; /* 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(fptr->common.function_name.u); - } else { - name_len = strlen(fptr->common.function_name.s); - } + name_len = u_strlen(fptr->common.function_name.u); lcname = zend_u_str_case_fold(utype, fptr->common.function_name, name_len, 0, &lcname_len); if (lcname_len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME) - 1 && @@ -2125,58 +2106,43 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio if (scope) { lc_class_name_len = scope->name_length; - if (UG(unicode)) { - if ((lc_class_name.u = u_memrchr(scope->name.u, ':', lc_class_name_len))) { - lc_class_name.u++; - lc_class_name_len -= (lc_class_name.u - scope->name.u); - } else { - lc_class_name = scope->name; - } + if ((lc_class_name.u = u_memrchr(scope->name.u, ':', lc_class_name_len))) { + lc_class_name.u++; + lc_class_name_len -= (lc_class_name.u - scope->name.u); } else { - if ((lc_class_name.s = zend_memrchr(scope->name.s, ':', lc_class_name_len))) { - lc_class_name.s++; - lc_class_name_len -= (lc_class_name.s - scope->name.s); - } else { - lc_class_name = scope->name; - } + lc_class_name = scope->name; } - lc_class_name = zend_u_str_case_fold(ZEND_STR_TYPE, lc_class_name, lc_class_name_len, 0, &lc_class_name_len); + + lc_class_name = zend_u_str_case_fold(IS_UNICODE, lc_class_name, lc_class_name_len, 0, &lc_class_name_len); } while (ptr->fname) { + int len = strlen(ptr->fname)+1; internal_function->handler = ptr->handler; - 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 = (char*)ptr->fname; - } + internal_function->function_name.u = malloc(UBYTES(len)); + u_charsToUChars(ptr->fname, internal_function->function_name.u, len); + internal_function->scope = scope; internal_function->prototype = NULL; if (ptr->arg_info) { - 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; - } + 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 = (zend_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 */ @@ -2248,9 +2214,9 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio * a constructor already. */ 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); + zstr lc_func_name = zend_u_str_case_fold(IS_UNICODE, 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) { + if ((lc_func_name_len == lc_class_name_len) && !memcmp(lc_func_name.v, lc_class_name.v, UBYTES(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; @@ -2529,8 +2495,8 @@ 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); } - 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); + lcname = zend_u_str_case_fold(IS_UNICODE, class_entry->name, class_entry->name_length, 0, &lcname_len); + zend_u_hash_update(CG(class_table), IS_UNICODE, lcname, lcname_len+1, &class_entry, sizeof(zend_class_entry *), NULL); efree(lcname.v); return class_entry; } @@ -2916,10 +2882,8 @@ get_function_via_handler: zstr method = mname; int method_len = mlen; - if (UG(unicode) && Z_TYPE_P(callable) == IS_STRING) { + if (Z_TYPE_P(callable) == IS_STRING) { zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &method.u, &method_len, mname.s, mlen TSRMLS_CC); - } else if (!UG(unicode) && Z_TYPE_P(callable) == IS_UNICODE) { - zend_unicode_to_string(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &method.s, &method_len, mname.u, mlen TSRMLS_CC); } fcc->function_handler = Z_OBJ_HT_P(fcc->object_ptr)->get_method(&fcc->object_ptr, method, method_len TSRMLS_CC); if (method.v != mname.v) { @@ -3055,48 +3019,28 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint ch fcc->object_ptr = object_ptr; fcc->calling_scope = Z_OBJCE_P(object_ptr); if (callable_name) { - if (UG(unicode)) { - Z_TYPE_P(callable_name) = IS_UNICODE; - Z_USTRLEN_P(callable_name) = fcc->calling_scope->name_length + Z_UNILEN_P(callable) + 2; - Z_USTRVAL_P(callable_name) = eumalloc(Z_USTRLEN_P(callable_name)+1); - memcpy(Z_USTRVAL_P(callable_name), fcc->calling_scope->name.u, UBYTES(fcc->calling_scope->name_length)); - Z_USTRVAL_P(callable_name)[fcc->calling_scope->name_length] = ':'; - Z_USTRVAL_P(callable_name)[fcc->calling_scope->name_length+1] = ':'; - if (Z_TYPE_P(callable) == IS_UNICODE) { - u_memcpy(Z_USTRVAL_P(callable_name)+fcc->calling_scope->name_length+2, Z_USTRVAL_P(callable), Z_USTRLEN_P(callable)+1); - } else { - zval *method = callable; - zval copy; - int use_copy; - - zend_make_unicode_zval(method, ©, &use_copy); - u_memcpy(Z_USTRVAL_P(callable_name)+fcc->calling_scope->name_length+2, Z_USTRVAL(copy), Z_USTRLEN(copy)+1); - zval_dtor(©); - } + Z_TYPE_P(callable_name) = IS_UNICODE; + Z_USTRLEN_P(callable_name) = fcc->calling_scope->name_length + Z_UNILEN_P(callable) + 2; + Z_USTRVAL_P(callable_name) = eumalloc(Z_USTRLEN_P(callable_name)+1); + memcpy(Z_USTRVAL_P(callable_name), fcc->calling_scope->name.u, UBYTES(fcc->calling_scope->name_length)); + Z_USTRVAL_P(callable_name)[fcc->calling_scope->name_length] = ':'; + Z_USTRVAL_P(callable_name)[fcc->calling_scope->name_length+1] = ':'; + if (Z_TYPE_P(callable) == IS_UNICODE) { + u_memcpy(Z_USTRVAL_P(callable_name)+fcc->calling_scope->name_length+2, Z_USTRVAL_P(callable), Z_USTRLEN_P(callable)+1); } else { - Z_TYPE_P(callable_name) = IS_STRING; - Z_STRLEN_P(callable_name) = fcc->calling_scope->name_length + Z_UNILEN_P(callable) + 2; - Z_STRVAL_P(callable_name) = emalloc(Z_STRLEN_P(callable_name)+1); - memcpy(Z_STRVAL_P(callable_name), fcc->calling_scope->name.s, fcc->calling_scope->name_length); - Z_STRVAL_P(callable_name)[fcc->calling_scope->name_length] = ':'; - Z_STRVAL_P(callable_name)[fcc->calling_scope->name_length+1] = ':'; - if (Z_TYPE_P(callable) == IS_STRING) { - memcpy(Z_STRVAL_P(callable_name)+fcc->calling_scope->name_length+2, Z_STRVAL_P(callable), Z_STRLEN_P(callable)+1); - } else { - zval *method = callable; - zval copy; - int use_copy; + zval *method = callable; + zval copy; + int use_copy; - zend_make_string_zval(method, ©, &use_copy); - memcpy(Z_STRVAL_P(callable_name)+fcc->calling_scope->name_length+2, Z_STRVAL(copy), Z_STRLEN(copy)+1); - zval_dtor(©); - } + zend_make_unicode_zval(method, ©, &use_copy); + u_memcpy(Z_USTRVAL_P(callable_name)+fcc->calling_scope->name_length+2, Z_USTRVAL(copy), Z_USTRLEN(copy)+1); + zval_dtor(©); } } } else if (callable_name) { *callable_name = *callable; zval_copy_ctor(callable_name); - convert_to_text(callable_name); + convert_to_unicode(callable_name); } if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) { fcc->called_scope = fcc->calling_scope; @@ -3133,58 +3077,30 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint ch if (Z_TYPE_PP(obj) == IS_STRING || Z_TYPE_PP(obj) == IS_UNICODE) { if (callable_name) { - if (UG(unicode)) { - Z_TYPE_P(callable_name) = IS_UNICODE; - Z_USTRLEN_P(callable_name) = Z_UNILEN_PP(obj) + Z_UNILEN_PP(method) + 2; - Z_USTRVAL_P(callable_name) = eumalloc(Z_USTRLEN_P(callable_name)+1); - if (Z_TYPE_PP(obj) == IS_UNICODE) { - u_memcpy(Z_USTRVAL_P(callable_name), Z_USTRVAL_PP(obj), Z_USTRLEN_PP(obj)); - } else { - zval copy; - int use_copy; - - zend_make_unicode_zval(*obj, ©, &use_copy); - u_memcpy(Z_USTRVAL_P(callable_name), Z_USTRVAL(copy), Z_USTRLEN(copy)); - zval_dtor(©); - } - Z_USTRVAL_P(callable_name)[Z_UNILEN_PP(obj)] = ':'; - Z_USTRVAL_P(callable_name)[Z_UNILEN_PP(obj)+1] = ':'; - if (Z_TYPE_PP(method) == IS_UNICODE) { - u_memcpy(Z_USTRVAL_P(callable_name)+Z_UNILEN_PP(obj)+2, Z_USTRVAL_PP(method), Z_USTRLEN_PP(method)+1); - } else { - zval copy; - int use_copy; - - zend_make_unicode_zval(*method, ©, &use_copy); - u_memcpy(Z_USTRVAL_P(callable_name)+Z_UNILEN_PP(obj)+2, Z_USTRVAL(copy), Z_USTRLEN(copy)+1); - zval_dtor(©); - } + Z_TYPE_P(callable_name) = IS_UNICODE; + Z_USTRLEN_P(callable_name) = Z_UNILEN_PP(obj) + Z_UNILEN_PP(method) + 2; + Z_USTRVAL_P(callable_name) = eumalloc(Z_USTRLEN_P(callable_name)+1); + if (Z_TYPE_PP(obj) == IS_UNICODE) { + u_memcpy(Z_USTRVAL_P(callable_name), Z_USTRVAL_PP(obj), Z_USTRLEN_PP(obj)); + } else { + zval copy; + int use_copy; + + zend_make_unicode_zval(*obj, ©, &use_copy); + u_memcpy(Z_USTRVAL_P(callable_name), Z_USTRVAL(copy), Z_USTRLEN(copy)); + zval_dtor(©); + } + Z_USTRVAL_P(callable_name)[Z_UNILEN_PP(obj)] = ':'; + Z_USTRVAL_P(callable_name)[Z_UNILEN_PP(obj)+1] = ':'; + if (Z_TYPE_PP(method) == IS_UNICODE) { + u_memcpy(Z_USTRVAL_P(callable_name)+Z_UNILEN_PP(obj)+2, Z_USTRVAL_PP(method), Z_USTRLEN_PP(method)+1); } else { - Z_TYPE_P(callable_name) = IS_STRING; - Z_STRLEN_P(callable_name) = Z_UNILEN_PP(obj) + Z_UNILEN_PP(method) + 2; - Z_STRVAL_P(callable_name) = emalloc(Z_STRLEN_P(callable_name)+1); - if (Z_TYPE_PP(obj) == IS_STRING) { - memcpy(Z_STRVAL_P(callable_name), Z_STRVAL_PP(obj), Z_STRLEN_PP(obj)); - } else { - zval copy; - int use_copy; - - zend_make_string_zval(*obj, ©, &use_copy); - memcpy(Z_STRVAL_P(callable_name), Z_STRVAL(copy), Z_STRLEN(copy)); - zval_dtor(©); - } - Z_STRVAL_P(callable_name)[Z_UNILEN_PP(obj)] = ':'; - Z_STRVAL_P(callable_name)[Z_UNILEN_PP(obj)+1] = ':'; - if (Z_TYPE_PP(method) == IS_STRING) { - memcpy(Z_STRVAL_P(callable_name)+Z_UNILEN_PP(obj)+2, Z_STRVAL_PP(method), Z_STRLEN_PP(method)+1); - } else { - zval copy; - int use_copy; - - zend_make_string_zval(*method, ©, &use_copy); - memcpy(Z_STRVAL_P(callable_name)+Z_UNILEN_PP(obj)+2, Z_STRVAL(copy), Z_STRLEN(copy)+1); - zval_dtor(©); - } + zval copy; + int use_copy; + + zend_make_unicode_zval(*method, ©, &use_copy); + u_memcpy(Z_USTRVAL_P(callable_name)+Z_UNILEN_PP(obj)+2, Z_USTRVAL(copy), Z_USTRLEN(copy)+1); + zval_dtor(©); } } @@ -3206,40 +3122,21 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint ch fcc->object_ptr = *obj; if (callable_name) { - if (UG(unicode)) { - Z_TYPE_P(callable_name) = IS_UNICODE; - Z_USTRLEN_P(callable_name) = fcc->calling_scope->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), fcc->calling_scope->name.u, UBYTES(fcc->calling_scope->name_length)); - Z_USTRVAL_P(callable_name)[fcc->calling_scope->name_length] = ':'; - Z_USTRVAL_P(callable_name)[fcc->calling_scope->name_length+1] = ':'; - if (Z_TYPE_PP(method) == IS_UNICODE) { - u_memcpy(Z_USTRVAL_P(callable_name)+fcc->calling_scope->name_length+2, Z_USTRVAL_PP(method), Z_USTRLEN_PP(method)+1); - } else { - zval copy; - int use_copy; - - zend_make_unicode_zval(*method, ©, &use_copy); - u_memcpy(Z_USTRVAL_P(callable_name)+fcc->calling_scope->name_length+2, Z_USTRVAL(copy), Z_USTRLEN(copy)+1); - zval_dtor(©); - } + Z_TYPE_P(callable_name) = IS_UNICODE; + Z_USTRLEN_P(callable_name) = fcc->calling_scope->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), fcc->calling_scope->name.u, UBYTES(fcc->calling_scope->name_length)); + Z_USTRVAL_P(callable_name)[fcc->calling_scope->name_length] = ':'; + Z_USTRVAL_P(callable_name)[fcc->calling_scope->name_length+1] = ':'; + if (Z_TYPE_PP(method) == IS_UNICODE) { + u_memcpy(Z_USTRVAL_P(callable_name)+fcc->calling_scope->name_length+2, Z_USTRVAL_PP(method), Z_USTRLEN_PP(method)+1); } else { - Z_TYPE_P(callable_name) = IS_STRING; - Z_STRLEN_P(callable_name) = fcc->calling_scope->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), fcc->calling_scope->name.s, fcc->calling_scope->name_length); - Z_STRVAL_P(callable_name)[fcc->calling_scope->name_length] = ':'; - Z_STRVAL_P(callable_name)[fcc->calling_scope->name_length+1] = ':'; - if (Z_TYPE_PP(method) == IS_STRING) { - memcpy(Z_STRVAL_P(callable_name)+fcc->calling_scope->name_length+2, Z_STRVAL_PP(method), Z_STRLEN_PP(method)+1); - } else { - zval copy; - int use_copy; - - zend_make_string_zval(*method, ©, &use_copy); - memcpy(Z_STRVAL_P(callable_name)+fcc->calling_scope->name_length+2, Z_STRVAL(copy), Z_STRLEN(copy)+1); - zval_dtor(©); - } + zval copy; + int use_copy; + + zend_make_unicode_zval(*method, ©, &use_copy); + u_memcpy(Z_USTRVAL_P(callable_name)+fcc->calling_scope->name_length+2, Z_USTRVAL(copy), Z_USTRLEN(copy)+1); + zval_dtor(©); } } @@ -3286,19 +3183,11 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint ch if (callable_name) { zend_class_entry *ce = Z_OBJCE_P(callable); /* TBFixed: what if it's overloaded? */ - if (UG(unicode)) { - Z_TYPE_P(callable_name) = IS_UNICODE; - Z_USTRLEN_P(callable_name) = ce->name_length + sizeof("::__invoke") - 1; - Z_USTRVAL_P(callable_name) = eumalloc(Z_USTRLEN_P(callable_name)+1); - u_memcpy(Z_USTRVAL_P(callable_name), ce->name.u, ce->name_length); - u_charsToUChars("::__invoke", Z_USTRVAL_P(callable_name) + ce->name_length, sizeof("::__invoke")); - } else { - Z_TYPE_P(callable_name) = IS_STRING; - Z_STRLEN_P(callable_name) = ce->name_length + sizeof("::__invoke") - 1; - Z_STRVAL_P(callable_name) = emalloc(Z_STRLEN_P(callable_name) + 1); - memcpy(Z_STRVAL_P(callable_name), ce->name.s, ce->name_length); - memcpy(Z_STRVAL_P(callable_name) + ce->name_length, "::__invoke", sizeof("::__invoke")); - } + Z_TYPE_P(callable_name) = IS_UNICODE; + Z_USTRLEN_P(callable_name) = ce->name_length + sizeof("::__invoke") - 1; + Z_USTRVAL_P(callable_name) = eumalloc(Z_USTRLEN_P(callable_name)+1); + u_memcpy(Z_USTRVAL_P(callable_name), ce->name.u, ce->name_length); + u_charsToUChars("::__invoke", Z_USTRVAL_P(callable_name) + ce->name_length, sizeof("::__invoke")); } return 1; } @@ -3308,7 +3197,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint ch if (callable_name) { *callable_name = *callable; zval_copy_ctor(callable_name); - convert_to_text(callable_name); + convert_to_unicode(callable_name); } if (error) zend_spprintf(error, 0, "no array or string given"); return 0; @@ -3612,19 +3501,15 @@ 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, const char *name, int name_length, zval *property, int access_type, zstr doc_comment, int doc_comment_len TSRMLS_DC) /* {{{ */ { - if (UG(unicode)) { - zstr uname; - int ret; - ALLOCA_FLAG(use_heap) + zstr uname; + int ret; + ALLOCA_FLAG(use_heap) - uname.u = do_alloca(UBYTES(name_length+1), use_heap); - 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, use_heap); - 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); - } + uname.u = do_alloca(UBYTES(name_length+1), use_heap); + 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, use_heap); + return ret; } /* }}} */ @@ -3636,19 +3521,15 @@ 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) /* {{{ */ { - if (UG(unicode)) { - zstr uname; - int ret; - ALLOCA_FLAG(use_heap) + zstr uname; + int ret; + ALLOCA_FLAG(use_heap) - uname.u = do_alloca(UBYTES(name_length+1), use_heap); - 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, use_heap); - return ret; - } else { - return zend_u_declare_property_ex(ce, IS_STRING, ZSTR(name), name_length, property, access_type, NULL_ZSTR, 0 TSRMLS_CC); - } + uname.u = do_alloca(UBYTES(name_length+1), use_heap); + 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, use_heap); + return ret; } /* }}} */ @@ -3718,14 +3599,10 @@ ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int if (ce->type & ZEND_INTERNAL_CLASS) { ALLOC_PERMANENT_ZVAL(property); - 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); - } + 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 { ALLOC_ZVAL(property); ZVAL_ASCII_STRINGL(property, value, len, 1); @@ -3741,14 +3618,10 @@ ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, char *name, int if (ce->type & ZEND_INTERNAL_CLASS) { ALLOC_PERMANENT_ZVAL(property); - 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); - } + 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 { ALLOC_ZVAL(property); ZVAL_ASCII_STRINGL(property, value, value_len, 1); @@ -3830,14 +3703,10 @@ ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, const cha if (ce->type & ZEND_INTERNAL_CLASS) { ALLOC_PERMANENT_ZVAL(constant); - 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); - } + 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 { ALLOC_ZVAL(constant); ZVAL_ASCII_STRINGL(constant, value, value_length, 1); @@ -4303,7 +4172,7 @@ ZEND_API zval *zend_read_static_property(zend_class_entry *scope, char *name, in ZEND_API zend_uchar zend_get_unified_string_type(int num_args TSRMLS_DC, ...) /* {{{ */ { va_list ap; - int best_type = ZEND_STR_TYPE; + int best_type = IS_UNICODE; int type; if (num_args <= 0) return (zend_uchar)-1; diff --git a/Zend/zend_API.h b/Zend/zend_API.h index e554d28273..495cea59e6 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -166,12 +166,8 @@ typedef struct _zend_fcall_info_cache { #define INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, class_name_len, functions, handle_fcall, handle_propget, handle_propset, handle_propunset, handle_propisset) \ { \ int _len = class_name_len; \ - if (UG(unicode)) { \ - class_container.name.u = (UChar *)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.u = (UChar *)malloc(UBYTES(_len+1)); \ + u_charsToUChars(class_name, class_container.name.u, _len+1); \ class_container.name_length = _len; \ class_container.builtin_functions = functions; \ class_container.constructor = NULL; \ @@ -326,18 +322,10 @@ ZEND_API void zend_update_property_unicode(zend_class_entry *scope, zval *object ZEND_API void zend_update_property_unicodel(zend_class_entry *scope, zval *object, char *name, int name_length, UChar *value, int value_length TSRMLS_DC); #define zend_update_property_text(ce, obj, key, key_len, str) \ - if (UG(unicode)) { \ - zend_update_property_unicode(ce, obj, key, key_len, (str).u TSRMLS_CC); \ - } else { \ - zend_update_property_string(ce, obj, key, key_len, (str).s TSRMLS_CC); \ - } + zend_update_property_unicode(ce, obj, key, key_len, (str).u TSRMLS_CC); #define zend_update_property_textl(ce, obj, key, key_len, str, len) \ - if (UG(unicode)) { \ - zend_update_property_unicodel(ce, obj, key, key_len, str.u, len TSRMLS_CC); \ - } else { \ - zend_update_property_stringl(ce, obj, key, key_len, str.s, len TSRMLS_CC); \ - } + zend_update_property_unicodel(ce, obj, key, key_len, str.u, len TSRMLS_CC); ZEND_API int zend_update_static_property(zend_class_entry *scope, char *name, int name_length, zval *value TSRMLS_DC); @@ -458,59 +446,39 @@ ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, uint key_len, zval *v add_assoc_zval_ex(arg, key, key_len, ___tmp); \ } while (0) #define add_assoc_text_ex(arg, key, key_len, str, duplicate) do { \ - if (UG(unicode)) { \ - add_assoc_unicode_ex(arg, key, key_len, (str).u, duplicate); \ - } else { \ - add_assoc_string_ex(arg, key, key_len, (str).s, duplicate); \ - } \ + add_assoc_unicode_ex(arg, key, key_len, (str).u, duplicate); \ } while (0) #define add_assoc_textl_ex(arg, key, key_len, str, length, duplicate) do { \ - if (UG(unicode)) { \ - add_assoc_unicodel_ex(arg, key, key_len, (str).u, length, duplicate); \ - } else { \ - add_assoc_stringl_ex(arg, key, key_len, (str).s, length, duplicate); \ - } \ + add_assoc_unicodel_ex(arg, key, key_len, (str).u, length, duplicate); \ } while (0) #define add_assoc_ascii_stringl_ex(arg, key, key_len, str, length, flags) do { \ - if (UG(unicode)) { \ - int ___u_len = length; \ - UChar *___u_str = zend_ascii_to_unicode((str), (___u_len)+1 ZEND_FILE_LINE_CC); \ - ___u_str[___u_len] = 0; \ - if ((flags) & ZSTR_AUTOFREE) { \ - efree(str); \ - } \ - add_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \ - } else { \ - add_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \ + int ___u_len = length; \ + UChar *___u_str = zend_ascii_to_unicode((str), (___u_len)+1 ZEND_FILE_LINE_CC); \ + ___u_str[___u_len] = 0; \ + if ((flags) & ZSTR_AUTOFREE) { \ + efree(str); \ } \ + add_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \ } while (0) #define add_assoc_rt_stringl_ex(arg, key, key_len, str, length, flags) do { \ - if (UG(unicode)) { \ - UChar *___u_str; \ - int ___u_len; \ - if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ - add_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \ - } \ - if ((flags) & ZSTR_AUTOFREE) { \ - efree(str); \ - } \ - } else { \ - add_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \ + UChar *___u_str; \ + int ___u_len; \ + if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ + add_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \ + } \ + if ((flags) & ZSTR_AUTOFREE) { \ + efree(str); \ } \ } while (0) #define add_assoc_utf8_stringl_ex(arg, key, key_len, str, length, flags) do { \ - if (UG(unicode)) { \ - UChar *___u_str; \ - int ___u_len; \ - if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ - add_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \ - } \ - if ((flags) & ZSTR_AUTOFREE) { \ - efree(str); \ - } \ - } else { \ - add_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \ + UChar *___u_str; \ + int ___u_len; \ + if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ + add_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \ + } \ + if ((flags) & ZSTR_AUTOFREE) { \ + efree(str); \ } \ } while (0) #define add_assoc_string_ex(arg, key, key_len, str, flags) add_assoc_stringl_ex(arg, key, key_len, str, strlen(str), flags) @@ -602,59 +570,39 @@ ZEND_API int add_ascii_assoc_zval_ex(zval *arg, const char *key, uint key_len, z add_ascii_assoc_zval_ex(arg, key, key_len, ___tmp); \ } while (0) #define add_ascii_assoc_text_ex(arg, key, key_len, str, duplicate) do { \ - if (UG(unicode)) { \ - add_ascii_assoc_unicode_ex(arg, key, key_len, (str).u, duplicate); \ - } else { \ - add_ascii_assoc_string_ex(arg, key, key_len, (str).s, duplicate); \ - } \ + add_ascii_assoc_unicode_ex(arg, key, key_len, (str).u, duplicate); \ } while (0) #define add_ascii_assoc_textl_ex(arg, key, key_len, str, length, duplicate) do { \ - if (UG(unicode)) { \ - add_ascii_assoc_unicodel_ex(arg, key, key_len, (str).u, length, duplicate); \ - } else { \ - add_ascii_assoc_stringl_ex(arg, key, key_len, (str).s, length, duplicate); \ - } \ + add_ascii_assoc_unicodel_ex(arg, key, key_len, (str).u, length, duplicate); \ } while (0) #define add_ascii_assoc_ascii_stringl_ex(arg, key, key_len, str, length, flags) do { \ - if (UG(unicode)) { \ - int ___u_len = length; \ - UChar *___u_str = zend_ascii_to_unicode((str), (___u_len)+1 ZEND_FILE_LINE_CC); \ - ___u_str[___u_len] = 0; \ - if ((flags) & ZSTR_AUTOFREE) { \ - efree(str); \ - } \ - add_ascii_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \ - } else { \ - add_ascii_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \ + int ___u_len = length; \ + UChar *___u_str = zend_ascii_to_unicode((str), (___u_len)+1 ZEND_FILE_LINE_CC); \ + ___u_str[___u_len] = 0; \ + if ((flags) & ZSTR_AUTOFREE) { \ + efree(str); \ } \ + add_ascii_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \ } while (0) #define add_ascii_assoc_rt_stringl_ex(arg, key, key_len, str, length, flags) do { \ - if (UG(unicode)) { \ - UChar *___u_str; \ - int ___u_len; \ - if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ - add_ascii_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \ - } \ - if ((flags) & ZSTR_AUTOFREE) { \ - efree(str); \ - } \ - } else { \ - add_ascii_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \ + UChar *___u_str; \ + int ___u_len; \ + if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ + add_ascii_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \ + } \ + if ((flags) & ZSTR_AUTOFREE) { \ + efree(str); \ } \ } while (0) #define add_ascii_assoc_utf8_stringl_ex(arg, key, key_len, str, length, flags) do { \ - if (UG(unicode)) { \ - UChar *___u_str; \ - int ___u_len; \ - if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ - add_ascii_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \ - } \ - if ((flags) & ZSTR_AUTOFREE) { \ - efree(str); \ - } \ - } else { \ - add_ascii_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \ + UChar *___u_str; \ + int ___u_len; \ + if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ + add_ascii_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \ + } \ + if ((flags) & ZSTR_AUTOFREE) { \ + efree(str); \ } \ } while (0) @@ -747,59 +695,39 @@ ZEND_API int add_rt_assoc_zval_ex(zval *arg, const char *key, uint key_len, zval add_rt_assoc_zval_ex(arg, key, key_len, ___tmp); \ } while (0) #define add_rt_assoc_text_ex(arg, key, key_len, str, duplicate) do { \ - if (UG(unicode)) { \ - add_rt_assoc_unicode_ex(arg, key, key_len, (str).u, duplicate); \ - } else { \ - add_rt_assoc_string_ex(arg, key, key_len, (str).s, duplicate); \ - } \ + add_rt_assoc_unicode_ex(arg, key, key_len, (str).u, duplicate); \ } while (0) #define add_rt_assoc_textl_ex(arg, key, key_len, str, length, duplicate) do { \ - if (UG(unicode)) { \ - add_rt_assoc_unicodel_ex(arg, key, key_len, (str).u, length, duplicate); \ - } else { \ - add_rt_assoc_stringl_ex(arg, key, key_len, (str).s, length, duplicate); \ - } \ + add_rt_assoc_unicodel_ex(arg, key, key_len, (str).u, length, duplicate); \ } while (0) #define add_rt_assoc_ascii_stringl_ex(arg, key, key_len, str, length, flags) do { \ - if (UG(unicode)) { \ - int ___u_len = length; \ - UChar *___u_str = zend_ascii_to_unicode((str), (___u_len)+1 ZEND_FILE_LINE_CC); \ - ___u_str[___u_len] = 0; \ - if ((flags) & ZSTR_AUTOFREE) { \ - efree(str); \ - } \ - add_rt_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \ - } else { \ - add_rt_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \ + int ___u_len = length; \ + UChar *___u_str = zend_ascii_to_unicode((str), (___u_len)+1 ZEND_FILE_LINE_CC); \ + ___u_str[___u_len] = 0; \ + if ((flags) & ZSTR_AUTOFREE) { \ + efree(str); \ } \ + add_rt_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \ } while (0) #define add_rt_assoc_rt_stringl_ex(arg, key, key_len, str, length, flags) do { \ - if (UG(unicode)) { \ - UChar *___u_str; \ - int ___u_len; \ - if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ - add_rt_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \ - } \ - if ((flags) & ZSTR_AUTOFREE) { \ - efree(str); \ - } \ - } else { \ - add_rt_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \ + UChar *___u_str; \ + int ___u_len; \ + if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ + add_rt_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \ + } \ + if ((flags) & ZSTR_AUTOFREE) { \ + efree(str); \ } \ } while (0) #define add_rt_assoc_utf8_stringl_ex(arg, key, key_len, str, length, flags) do { \ - if (UG(unicode)) { \ - UChar *___u_str; \ - int ___u_len; \ - if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ - add_rt_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \ - } \ - if ((flags) & ZSTR_AUTOFREE) { \ - efree(str); \ - } \ - } else { \ - add_rt_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \ + UChar *___u_str; \ + int ___u_len; \ + if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ + add_rt_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \ + } \ + if ((flags) & ZSTR_AUTOFREE) { \ + efree(str); \ } \ } while (0) @@ -892,59 +820,39 @@ ZEND_API int add_utf8_assoc_zval_ex(zval *arg, const char *key, uint key_len, zv add_utf8_assoc_zval_ex(arg, key, key_len, ___tmp); \ } while (0) #define add_utf8_assoc_text_ex(arg, key, key_len, str, duplicate) do { \ - if (UG(unicode)) { \ - add_utf8_assoc_unicode_ex(arg, key, key_len, (str).u, duplicate); \ - } else { \ - add_utf8_assoc_string_ex(arg, key, key_len, (str).s, duplicate); \ - } \ + add_utf8_assoc_unicode_ex(arg, key, key_len, (str).u, duplicate); \ } while (0) #define add_utf8_assoc_textl_ex(arg, key, key_len, str, length, duplicate) do { \ - if (UG(unicode)) { \ - add_utf8_assoc_unicodel_ex(arg, key, key_len, (str).u, length, duplicate); \ - } else { \ - add_utf8_assoc_stringl_ex(arg, key, key_len, (str).s, length, duplicate); \ - } \ + add_utf8_assoc_unicodel_ex(arg, key, key_len, (str).u, length, duplicate); \ } while (0) #define add_utf8_assoc_ascii_stringl_ex(arg, key, key_len, str, length, flags) do { \ - if (UG(unicode)) { \ - int ___u_len = length; \ - UChar *___u_str = zend_ascii_to_unicode((str), (___u_len)+1 ZEND_FILE_LINE_CC); \ - ___u_str[___u_len] = 0; \ - if ((flags) & ZSTR_AUTOFREE) { \ - efree(str); \ - } \ - add_utf8_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \ - } else { \ - add_utf8_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \ + int ___u_len = length; \ + UChar *___u_str = zend_ascii_to_unicode((str), (___u_len)+1 ZEND_FILE_LINE_CC); \ + ___u_str[___u_len] = 0; \ + if ((flags) & ZSTR_AUTOFREE) { \ + efree(str); \ } \ + add_utf8_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \ } while (0) #define add_utf8_assoc_rt_stringl_ex(arg, key, key_len, str, length, flags) do { \ - if (UG(unicode)) { \ - UChar *___u_str; \ - int ___u_len; \ - if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ - add_utf8_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \ - } \ - if ((flags) & ZSTR_AUTOFREE) { \ - efree(str); \ - } \ - } else { \ - add_utf8_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \ + UChar *___u_str; \ + int ___u_len; \ + if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ + add_utf8_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \ + } \ + if ((flags) & ZSTR_AUTOFREE) { \ + efree(str); \ } \ } while (0) #define add_utf8_assoc_utf8_stringl_ex(arg, key, key_len, str, length, flags) do { \ - if (UG(unicode)) { \ - UChar *___u_str; \ - int ___u_len; \ - if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ - add_utf8_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \ - } \ - if ((flags) & ZSTR_AUTOFREE) { \ - efree(str); \ - } \ - } else { \ - add_utf8_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \ + UChar *___u_str; \ + int ___u_len; \ + if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ + add_utf8_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \ + } \ + if ((flags) & ZSTR_AUTOFREE) { \ + efree(str); \ } \ } while (0) @@ -1047,59 +955,39 @@ ZEND_API int add_utf8_property_zval_ex(zval *arg, char *key, uint key_len, zval zval_ptr_dtor(&___tmp); /* write_property will add 1 to refcount */ \ } while (0) #define add_utf8_property_text_ex(arg, key, key_len, str, duplicate) do { \ - if (UG(unicode)) { \ - add_utf8_property_unicode_ex(arg, key, key_len, (str).u, duplicate); \ - } else { \ - add_utf8_property_string_ex(arg, key, key_len, (str).s, duplicate); \ - } \ + add_utf8_property_unicode_ex(arg, key, key_len, (str).u, duplicate); \ } while (0) #define add_utf8_property_textl_ex(arg, key, key_len, str, length, duplicate) do { \ - if (UG(unicode)) { \ - add_utf8_property_unicodel_ex(arg, key, key_len, (str).u, length, duplicate); \ - } else { \ - add_utf8_property_stringl_ex(arg, key, key_len, (str).s, length, duplicate); \ - } \ + add_utf8_property_unicodel_ex(arg, key, key_len, (str).u, length, duplicate); \ } while (0) #define add_utf8_property_ascii_stringl_ex(arg, key, key_len, str, length, flags) do { \ - if (UG(unicode)) { \ - int ___u_len = length; \ - UChar *___u_str = zend_ascii_to_unicode((str), (___u_len)+1 ZEND_FILE_LINE_CC); \ - ___u_str[___u_len] = 0; \ - if ((flags) & ZSTR_AUTOFREE) { \ - efree(str); \ - } \ - add_utf8_property_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \ - } else { \ - add_utf8_property_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \ + int ___u_len = length; \ + UChar *___u_str = zend_ascii_to_unicode((str), (___u_len)+1 ZEND_FILE_LINE_CC); \ + ___u_str[___u_len] = 0; \ + if ((flags) & ZSTR_AUTOFREE) { \ + efree(str); \ } \ + add_utf8_property_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \ } while (0) #define add_utf8_property_rt_stringl_ex(arg, key, key_len, str, length, flags) do { \ - if (UG(unicode)) { \ - UChar *___u_str; \ - int ___u_len; \ - if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ - add_utf8_property_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \ - } \ - if ((flags) & ZSTR_AUTOFREE) { \ - efree(str); \ - } \ - } else { \ - add_utf8_property_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \ + UChar *___u_str; \ + int ___u_len; \ + if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ + add_utf8_property_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \ + } \ + if ((flags) & ZSTR_AUTOFREE) { \ + efree(str); \ } \ } while (0) #define add_utf8_property_utf8_stringl_ex(arg, key, key_len, str, length, flags) do { \ - if (UG(unicode)) { \ - UChar *___u_str; \ - int ___u_len; \ - if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ - add_utf8_property_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \ - } \ - if ((flags) & ZSTR_AUTOFREE) { \ - efree(str); \ - } \ - } else { \ - add_utf8_property_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \ + UChar *___u_str; \ + int ___u_len; \ + if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ + add_utf8_property_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \ + } \ + if ((flags) & ZSTR_AUTOFREE) { \ + efree(str); \ } \ } while (0) @@ -1166,59 +1054,39 @@ ZEND_API int add_u_assoc_zval_ex(zval *arg, zend_uchar type, zstr key, uint key_ add_u_assoc_zval_ex(arg, key_type, key, key_len, ___tmp); \ } while (0) #define add_u_assoc_text_ex(arg, type, key, key_len, str, duplicate) do { \ - if (UG(unicode)) { \ - add_u_assoc_unicode_ex(arg, type, key, key_len, (str).u, duplicate); \ - } else { \ - add_u_assoc_string_ex(arg, type, key, key_len, (str).s, duplicate); \ - } \ + add_u_assoc_unicode_ex(arg, type, key, key_len, (str).u, duplicate); \ } while (0) #define add_u_assoc_textl_ex(arg, type, key, key_len, str, length, duplicate) do { \ - if (UG(unicode)) { \ - add_u_assoc_unicodel_ex(arg, type, key, key_len, (str).u, length, duplicate); \ - } else { \ - add_u_assoc_stringl_ex(arg, type, key, key_len, (str).s, length, duplicate); \ - } \ + add_u_assoc_unicodel_ex(arg, type, key, key_len, (str).u, length, duplicate); \ } while (0) #define add_u_assoc_ascii_stringl_ex(arg, type, key, key_len, str, length, flags) do { \ - if (UG(unicode)) { \ - int ___u_len = length; \ - UChar *___u_str = zend_ascii_to_unicode((str), (___u_len)+1 ZEND_FILE_LINE_CC); \ - ___u_str[___u_len] = 0; \ - if ((flags) & ZSTR_AUTOFREE) { \ - efree(str); \ - } \ - add_u_assoc_unicodel_ex(arg, type, key, key_len, ___u_str, ___u_len, 0); \ - } else { \ - add_u_assoc_stringl_ex(arg, type, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \ + int ___u_len = length; \ + UChar *___u_str = zend_ascii_to_unicode((str), (___u_len)+1 ZEND_FILE_LINE_CC); \ + ___u_str[___u_len] = 0; \ + if ((flags) & ZSTR_AUTOFREE) { \ + efree(str); \ } \ + add_u_assoc_unicodel_ex(arg, type, key, key_len, ___u_str, ___u_len, 0); \ } while (0) #define add_u_assoc_rt_stringl_ex(arg, type, key, key_len, str, length, flags) do { \ - if (UG(unicode)) { \ - UChar *___u_str; \ - int ___u_len; \ - if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ - add_u_assoc_unicodel_ex(arg, type, key, key_len, ___u_str, ___u_len, 0); \ - } \ - if ((flags) & ZSTR_AUTOFREE) { \ - efree(str); \ - } \ - } else { \ - add_u_assoc_stringl_ex(arg, type, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \ + UChar *___u_str; \ + int ___u_len; \ + if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ + add_u_assoc_unicodel_ex(arg, type, key, key_len, ___u_str, ___u_len, 0); \ + } \ + if ((flags) & ZSTR_AUTOFREE) { \ + efree(str); \ } \ } while (0) #define add_u_assoc_utf8_stringl_ex(arg, type, key, key_len, str, length, flags) do { \ - if (UG(unicode)) { \ - UChar *___u_str; \ - int ___u_len; \ - if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ - add_u_assoc_unicodel_ex(arg, type, key, key_len, ___u_str, ___u_len, 0); \ - } \ - if ((flags) & ZSTR_AUTOFREE) { \ - efree(str); \ - } \ - } else { \ - add_u_assoc_stringl_ex(arg, type, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \ + UChar *___u_str; \ + int ___u_len; \ + if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ + add_u_assoc_unicodel_ex(arg, type, key, key_len, ___u_str, ___u_len, 0); \ + } \ + if ((flags) & ZSTR_AUTOFREE) { \ + efree(str); \ } \ } while (0) @@ -1311,59 +1179,39 @@ ZEND_API int add_index_zval(zval *arg, ulong index, zval *value); add_index_zval(arg, idx, ___tmp); \ } while (0) #define add_index_text(arg, idx, str, duplicate) do { \ - if (UG(unicode)) { \ - add_index_unicode(arg, idx, (str).u, duplicate); \ - } else { \ - add_index_string(arg, idx, (str).s, duplicate); \ - } \ + add_index_unicode(arg, idx, (str).u, duplicate); \ } while (0) #define add_index_textl(arg, idx, str, length, duplicate) do { \ - if (UG(unicode)) { \ - add_index_unicodel(arg, idx, (str).u, length, duplicate); \ - } else { \ - add_index_stringl(arg, idx, (str).s, length, duplicate); \ - } \ + add_index_unicodel(arg, idx, (str).u, length, duplicate); \ } while (0) #define add_index_ascii_stringl(arg, idx, str, length, flags) do { \ - if (UG(unicode)) { \ - int ___u_len = length; \ - UChar *___u_str = zend_ascii_to_unicode((str), (___u_len)+1 ZEND_FILE_LINE_CC); \ - ___u_str[___u_len] = 0; \ - if ((flags) & ZSTR_AUTOFREE) { \ - efree(str); \ - } \ - add_index_unicodel(arg, idx, ___u_str, ___u_len, 0); \ - } else { \ - add_index_stringl(arg, idx, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \ + int ___u_len = length; \ + UChar *___u_str = zend_ascii_to_unicode((str), (___u_len)+1 ZEND_FILE_LINE_CC); \ + ___u_str[___u_len] = 0; \ + if ((flags) & ZSTR_AUTOFREE) { \ + efree(str); \ } \ + add_index_unicodel(arg, idx, ___u_str, ___u_len, 0); \ } while (0) #define add_index_rt_stringl(arg, idx, str, length, flags) do {\ - if (UG(unicode)) { \ - UChar *___u_str; \ - int ___u_len; \ - if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ - add_index_unicodel(arg, idx, ___u_str, ___u_len, 0); \ - } \ - if ((flags) & ZSTR_AUTOFREE) { \ - efree(str); \ - } \ - } else { \ - add_index_stringl(arg, idx, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \ + UChar *___u_str; \ + int ___u_len; \ + if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ + add_index_unicodel(arg, idx, ___u_str, ___u_len, 0); \ + } \ + if ((flags) & ZSTR_AUTOFREE) { \ + efree(str); \ } \ } while (0) #define add_index_utf8_stringl(arg, idx, str, length, flags) do { \ - if (UG(unicode)) { \ - UChar *___u_str; \ - int ___u_len; \ - if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ - add_index_unicodel(arg, idx, ___u_str, ___u_len, 0); \ - } \ - if ((flags) & ZSTR_AUTOFREE) { \ - efree(str); \ - } \ - } else { \ - add_index_stringl(arg, idx, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \ + UChar *___u_str; \ + int ___u_len; \ + if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ + add_index_unicodel(arg, idx, ___u_str, ___u_len, 0); \ + } \ + if ((flags) & ZSTR_AUTOFREE) { \ + efree(str); \ } \ } while (0) @@ -1435,59 +1283,39 @@ ZEND_API int add_next_index_zval(zval *arg, zval *value); add_next_index_zval(arg, ___tmp); \ } while (0) #define add_next_index_text(arg, str, duplicate) do { \ - if (UG(unicode)) { \ - add_next_index_unicode(arg, (str).u, duplicate); \ - } else { \ - add_next_index_string(arg, (str).s, duplicate); \ - } \ + add_next_index_unicode(arg, (str).u, duplicate); \ } while (0) #define add_next_index_textl(arg, str, length, duplicate) do { \ - if (UG(unicode)) { \ - add_next_index_unicodel(arg, (str).u, length, duplicate); \ - } else { \ - add_next_index_stringl(arg, (str).s, length, duplicate); \ - } \ + add_next_index_unicodel(arg, (str).u, length, duplicate); \ } while (0) #define add_next_index_ascii_stringl(arg, str, length, flags) do { \ - if (UG(unicode)) { \ - int ___u_len = length; \ - UChar *___u_str = zend_ascii_to_unicode((str), (___u_len)+1 ZEND_FILE_LINE_CC); \ - ___u_str[___u_len] = 0; \ - if ((flags) & ZSTR_AUTOFREE) { \ - efree((char*)(str)); \ - } \ - add_next_index_unicodel(arg, ___u_str, ___u_len, 0); \ - } else { \ - add_next_index_stringl(arg, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \ + int ___u_len = length; \ + UChar *___u_str = zend_ascii_to_unicode((str), (___u_len)+1 ZEND_FILE_LINE_CC); \ + ___u_str[___u_len] = 0; \ + if ((flags) & ZSTR_AUTOFREE) { \ + efree((char*)(str)); \ } \ + add_next_index_unicodel(arg, ___u_str, ___u_len, 0); \ } while (0) #define add_next_index_rt_stringl(arg, str, length, flags) do { \ - if (UG(unicode)) { \ - UChar *___u_str; \ - int ___u_len; \ - if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ - add_next_index_unicodel(arg, ___u_str, ___u_len, 0); \ - } \ - if ((flags) & ZSTR_AUTOFREE) { \ - efree((char*)(str)); \ - } \ - } else { \ - add_next_index_stringl(arg, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \ + UChar *___u_str; \ + int ___u_len; \ + if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ + add_next_index_unicodel(arg, ___u_str, ___u_len, 0); \ + } \ + if ((flags) & ZSTR_AUTOFREE) { \ + efree((char*)(str)); \ } \ } while (0) #define add_next_index_utf8_stringl(arg, str, length, flags) do { \ - if (UG(unicode)) { \ - UChar *___u_str; \ - int ___u_len; \ - if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ - add_next_index_unicodel(arg, ___u_str, ___u_len, 0); \ - } \ - if ((flags) & ZSTR_AUTOFREE) { \ - efree((char*)(str)); \ - } \ - } else { \ - add_next_index_stringl(arg, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \ + UChar *___u_str; \ + int ___u_len; \ + if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \ + add_next_index_unicodel(arg, ___u_str, ___u_len, 0); \ + } \ + if ((flags) & ZSTR_AUTOFREE) { \ + efree((char*)(str)); \ } \ } while (0) @@ -1685,78 +1513,50 @@ END_EXTERN_C() } #define ZVAL_ASCII_STRING(z, s, flags) { \ - if (UG(unicode)) { \ - char *__s = (char*)(s); \ - int __s_len = strlen(__s); \ - UChar *u_str = zend_ascii_to_unicode(__s, __s_len+1 ZEND_FILE_LINE_CC); \ - u_str[__s_len] = 0; \ - if ((flags) & ZSTR_AUTOFREE) { \ - efree(__s); \ - } \ - ZVAL_UNICODEL(z, u_str, __s_len, 0); \ - } else { \ - const char *__s=(s); \ - Z_STRLEN_P(z) = strlen(__s); \ - Z_STRVAL_P(z) = (((flags) & ZSTR_DUPLICATE) ? estrndup(__s, Z_STRLEN_P(z)) :(char*) __s); \ - Z_TYPE_P(z) = IS_STRING; \ + char *__s = (char*)(s); \ + int __s_len = strlen(__s); \ + UChar *u_str = zend_ascii_to_unicode(__s, __s_len+1 ZEND_FILE_LINE_CC); \ + u_str[__s_len] = 0; \ + if ((flags) & ZSTR_AUTOFREE) { \ + efree(__s); \ } \ + ZVAL_UNICODEL(z, u_str, __s_len, 0); \ } #define ZVAL_ASCII_STRINGL(z, s, l, flags) { \ - if (UG(unicode)) { \ - char *__s = (char*)(s); \ - int __s_len = (l); \ - UChar *u_str = zend_ascii_to_unicode((__s), (__s_len)+1 ZEND_FILE_LINE_CC); \ - u_str[__s_len] = 0; \ - if ((flags) & ZSTR_AUTOFREE) { \ - efree(__s); \ - } \ - ZVAL_UNICODEL(z, u_str, __s_len, 0); \ - } else { \ - const char *__s=(s); int __l=l; \ - Z_STRLEN_P(z) = __l; \ - Z_STRVAL_P(z) = (((flags) & ZSTR_DUPLICATE) ? estrndup(__s, __l) : (char*)__s); \ - Z_TYPE_P(z) = IS_STRING; \ + char *__s = (char*)(s); \ + int __s_len = (l); \ + UChar *u_str = zend_ascii_to_unicode((__s), (__s_len)+1 ZEND_FILE_LINE_CC); \ + u_str[__s_len] = 0; \ + if ((flags) & ZSTR_AUTOFREE) { \ + efree(__s); \ } \ + ZVAL_UNICODEL(z, u_str, __s_len, 0); \ } #define ZVAL_U_STRING(conv, z, s, flags) { \ - if (UG(unicode)) { \ - char *__s = (char *)(s); \ - int __s_len = strlen(__s); \ - UChar *u_str; \ - int u_len; \ - if (zend_string_to_unicode(conv, &u_str, &u_len, __s, __s_len TSRMLS_CC) == SUCCESS) { \ - ZVAL_UNICODEL(z, u_str, u_len, 0); \ - } \ - if ((flags) & ZSTR_AUTOFREE) { \ - efree(__s); \ - } \ - } else { \ - char *__s=(char *)(s); \ - Z_STRLEN_P(z) = strlen(__s); \ - Z_STRVAL_P(z) = (((flags) & ZSTR_DUPLICATE) ? estrndup(__s, Z_STRLEN_P(z)) : (char*)__s); \ - Z_TYPE_P(z) = IS_STRING; \ + char *__s = (char *)(s); \ + int __s_len = strlen(__s); \ + UChar *u_str; \ + int u_len; \ + if (zend_string_to_unicode(conv, &u_str, &u_len, __s, __s_len TSRMLS_CC) == SUCCESS) { \ + ZVAL_UNICODEL(z, u_str, u_len, 0); \ + } \ + if ((flags) & ZSTR_AUTOFREE) { \ + efree(__s); \ } \ } #define ZVAL_U_STRINGL(conv, z, s, l, flags) { \ - if (UG(unicode)) { \ - char *__s = (char *)(s); \ - int __s_len = (l); \ - UChar *u_str; \ - int u_len; \ - if (zend_string_to_unicode(conv, &u_str, &u_len, __s, __s_len TSRMLS_CC) == SUCCESS) { \ - ZVAL_UNICODEL(z, u_str, u_len, 0); \ - } \ - if ((flags) & ZSTR_AUTOFREE) { \ - efree(__s); \ - } \ - } else { \ - char *__s=(char *)(s); int __l=l; \ - Z_STRLEN_P(z) = __l; \ - Z_STRVAL_P(z) = (((flags) & ZSTR_DUPLICATE) ? estrndup(__s, __l) : __s); \ - Z_TYPE_P(z) = IS_STRING; \ + char *__s = (char *)(s); \ + int __s_len = (l); \ + UChar *u_str; \ + int u_len; \ + if (zend_string_to_unicode(conv, &u_str, &u_len, __s, __s_len TSRMLS_CC) == SUCCESS) { \ + ZVAL_UNICODEL(z, u_str, u_len, 0); \ + } \ + if ((flags) & ZSTR_AUTOFREE) { \ + efree(__s); \ } \ } @@ -1847,28 +1647,16 @@ END_EXTERN_C() #define ZVAL_TEXT(z, t, duplicate) \ do { \ - if (UG(unicode)) { \ - ZVAL_UNICODE(z, t.u, duplicate); \ - } else { \ - ZVAL_STRING(z, t.s, duplicate); \ - } \ + ZVAL_UNICODE(z, t.u, duplicate); \ } while (0); #define ZVAL_TEXTL(z, t, l, duplicate) \ do { \ - if (UG(unicode)) { \ - ZVAL_UNICODEL(z, t.u, l, duplicate);\ - } else { \ - ZVAL_STRINGL(z, t.s, l, duplicate); \ - } \ + ZVAL_UNICODEL(z, t.u, l, duplicate); \ } while (0); #define ZVAL_EMPTY_TEXT(z) \ - if (UG(unicode)) { \ - ZVAL_EMPTY_UNICODE(z); \ - } else { \ - ZVAL_EMPTY_STRING(z); \ - } + ZVAL_EMPTY_UNICODE(z); #define ZVAL_ENC_STRINGL(z, t, conv, s, l, flags) { \ if (t == IS_UNICODE) { \ diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 078514725b..9804787ba0 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -648,7 +648,7 @@ repeat: goto repeat; } else if (Z_OBJ_HT_P(val)->cast_object) { ALLOC_INIT_ZVAL(val_free); - if (Z_OBJ_HT_P(val)->cast_object(val, val_free, UG(unicode)?IS_UNICODE:IS_STRING, NULL TSRMLS_CC) == SUCCESS) { + if (Z_OBJ_HT_P(val)->cast_object(val, val_free, IS_UNICODE, NULL TSRMLS_CC) == SUCCESS) { val = val_free; break; } @@ -781,7 +781,7 @@ ZEND_FUNCTION(get_parent_class) } else { ce = zend_get_class_entry(arg TSRMLS_CC); } - } else if (Z_TYPE_P(arg) == (UG(unicode)?IS_UNICODE:IS_STRING)) { + } else if (Z_TYPE_P(arg) == IS_UNICODE) { zend_class_entry **pce; if (zend_u_lookup_class(Z_TYPE_P(arg), Z_UNIVAL_P(arg), Z_UNILEN_P(arg), &pce TSRMLS_CC) == SUCCESS) { @@ -811,7 +811,7 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass) /* return; } - if (only_subclass && Z_TYPE_P(obj) == (UG(unicode)?IS_UNICODE:IS_STRING)) { + if (only_subclass && Z_TYPE_P(obj) == IS_UNICODE) { zend_class_entry **the_ce; if (zend_u_lookup_class(Z_TYPE_P(obj), Z_UNIVAL_P(obj), Z_UNILEN_P(obj), &the_ce TSRMLS_CC) == FAILURE) { zend_error(E_WARNING, "Unknown class passed as parameter"); @@ -985,12 +985,12 @@ ZEND_FUNCTION(get_object_vars) zend_hash_internal_pointer_reset_ex(properties, &pos); 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)) { - if (zend_check_property_access(zobj, ZEND_STR_TYPE, key, key_len-1 TSRMLS_CC) == SUCCESS) { - zend_u_unmangle_property_name(ZEND_STR_TYPE, key, key_len-1, &class_name, &prop_name); + if (zend_hash_get_current_key_ex(properties, &key, &key_len, &num_index, 0, &pos) == HASH_KEY_IS_UNICODE) { + if (zend_check_property_access(zobj, IS_UNICODE, key, key_len-1 TSRMLS_CC) == SUCCESS) { + zend_u_unmangle_property_name(IS_UNICODE, key, key_len-1, &class_name, &prop_name); /* Not separating references */ Z_ADDREF_PP(value); - add_u_assoc_zval(return_value, ZEND_STR_TYPE, prop_name, *value); + add_u_assoc_zval(return_value, IS_UNICODE, prop_name, *value); } } zend_hash_move_forward_ex(properties, &pos); @@ -1018,7 +1018,7 @@ ZEND_FUNCTION(get_class_methods) RETURN_FALSE; } ce = Z_OBJCE_P(klass); - } else if (Z_TYPE_P(klass) == (UG(unicode)?IS_UNICODE:IS_STRING)) { + } else if (Z_TYPE_P(klass) == IS_UNICODE) { if (zend_u_lookup_class(Z_TYPE_P(klass), Z_UNIVAL_P(klass), Z_UNILEN_P(klass), &pce TSRMLS_CC) == SUCCESS) { ce = *pce; } @@ -1041,15 +1041,13 @@ ZEND_FUNCTION(get_class_methods) zstr key; uint key_len; ulong num_index; - uint len = UG(unicode)?u_strlen(mptr->common.function_name.u):strlen(mptr->common.function_name.s); + uint len = u_strlen(mptr->common.function_name.u); /* Do not display old-style inherited constructors */ if ((mptr->common.fn_flags & ZEND_ACC_CTOR) == 0 || mptr->common.scope == ce || - zend_hash_get_current_key_ex(&ce->function_table, &key, &key_len, &num_index, 0, &pos) != (UG(unicode)?HASH_KEY_IS_UNICODE:HASH_KEY_IS_STRING) || - (UG(unicode) ? - (zend_u_binary_strcasecmp(key.u, key_len-1, mptr->common.function_name.u, len) == 0) : - (zend_binary_strcasecmp(key.s, key_len-1, mptr->common.function_name.s, len) == 0))) { + zend_hash_get_current_key_ex(&ce->function_table, &key, &key_len, &num_index, 0, &pos) != HASH_KEY_IS_UNICODE || + (zend_u_binary_strcasecmp(key.u, key_len-1, mptr->common.function_name.u, len) == 0)) { MAKE_STD_ZVAL(method_name); ZVAL_TEXT(method_name, mptr->common.function_name, 1); @@ -1079,7 +1077,7 @@ ZEND_FUNCTION(method_exists) if (Z_TYPE_P(klass) == IS_OBJECT) { ce = Z_OBJCE_P(klass); - } else if (Z_TYPE_P(klass) == (UG(unicode)?IS_UNICODE:IS_STRING)) { + } else if (Z_TYPE_P(klass) == IS_UNICODE) { if (zend_u_lookup_class(Z_TYPE_P(klass), Z_UNIVAL_P(klass), Z_UNILEN_P(klass), &pce TSRMLS_CC) == FAILURE) { RETURN_FALSE; } @@ -1393,7 +1391,7 @@ ZEND_FUNCTION(get_included_files) array_init(return_value); zend_hash_internal_pointer_reset_ex(&EG(included_files), &pos); while (zend_hash_get_current_key_ex(&EG(included_files), &entry, &len, NULL, 0, &pos) == HASH_KEY_IS_STRING) { - if (UG(unicode) && SUCCESS == zend_path_decode(&ustr, &ustr_len, entry.s, len - 1 TSRMLS_CC)) { + if (SUCCESS == zend_path_decode(&ustr, &ustr_len, entry.s, len - 1 TSRMLS_CC)) { add_next_index_unicodel(return_value, ustr, ustr_len, 0); } else { add_next_index_stringl(return_value, entry.s, len - 1, 1); @@ -1785,9 +1783,7 @@ ZEND_FUNCTION(create_function) } while (zend_hash_add(EG(function_table), function_name, function_name_length+1, &new_function, sizeof(zend_function), NULL)==FAILURE); zend_hash_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)); RETVAL_ASCII_STRINGL(function_name, function_name_length, 0); - if (UG(unicode)) { - efree(function_name); - } + efree(function_name); } else { RETURN_FALSE; } @@ -1861,7 +1857,7 @@ static int add_constant_info(zend_constant *constant, void *arg TSRMLS_DC) /* {{ *const_val = constant->value; zval_copy_ctor(const_val); INIT_PZVAL(const_val); - add_u_assoc_zval_ex(name_array, UG(unicode)?IS_UNICODE:IS_STRING, constant->name, constant->name_len, const_val); + add_u_assoc_zval_ex(name_array, IS_UNICODE, constant->name, constant->name_len, const_val); return 0; } /* }}} */ @@ -1943,7 +1939,7 @@ ZEND_FUNCTION(get_defined_constants) zval_copy_ctor(const_val); INIT_PZVAL(const_val); - add_u_assoc_zval_ex(modules[module_number], UG(unicode)?IS_UNICODE:IS_STRING, val->name, val->name_len, const_val); + add_u_assoc_zval_ex(modules[module_number], IS_UNICODE, val->name, val->name_len, const_val); bad_module_id: zend_hash_move_forward_ex(EG(zend_constants), &pos); @@ -2052,7 +2048,7 @@ ZEND_FUNCTION(debug_print_backtrace) function_name = ptr->function_state.function->common.function_name; if (function_name.v) { - function_name_string = !UG(unicode); + function_name_string = 0; if (ptr->object) { if (ptr->function_state.function->common.scope) { class_name = ptr->function_state.function->common.scope->name; @@ -2122,11 +2118,7 @@ ZEND_FUNCTION(debug_print_backtrace) } zend_printf("#%-2d ", indent); if (class_name.v) { - if (UG(unicode)) { - zend_printf("%r", class_name.u); - } else { - ZEND_PUTS(class_name.s); - } + zend_printf("%r", class_name.u); ZEND_PUTS(call_type); } if (function_name_string) { diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index 2ba3027357..5581b22983 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -99,11 +99,8 @@ ZEND_API zend_function *zend_get_closure_invoke_method(zval *obj TSRMLS_DC) /* { invoke->internal_function.handler = ZEND_MN(Closure___invoke); invoke->internal_function.module = 0; invoke->internal_function.scope = zend_ce_closure; - if (UG(unicode)) { - invoke->internal_function.function_name.u = USTR_MAKE(ZEND_INVOKE_FUNC_NAME); - } else { - invoke->internal_function.function_name.s = estrndup(ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1); - } + invoke->internal_function.function_name.u = USTR_MAKE(ZEND_INVOKE_FUNC_NAME); + return invoke; } /* }}} */ @@ -126,12 +123,11 @@ static zend_function *zend_closure_get_method(zval **object_ptr, zstr method_nam { unsigned int lc_name_len; zstr lc_name; - zend_uchar type = UG(unicode)?IS_UNICODE:IS_STRING; /* Create a zend_copy_str_tolower(dest, src, src_length); */ - lc_name = zend_u_str_case_fold(type, method_name, method_len, 1, &lc_name_len); + lc_name = zend_u_str_case_fold(IS_UNICODE, method_name, method_len, 1, &lc_name_len); if ((lc_name_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) && - (ZEND_U_EQUAL(type, lc_name, lc_name_len, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1)) + (ZEND_U_EQUAL(IS_UNICODE, lc_name, lc_name_len, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1)) ) { efree(lc_name.v); return zend_get_closure_invoke_method(*object_ptr TSRMLS_CC); diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index e45fef2a20..4b75d58083 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -37,31 +37,16 @@ ZEND_API zend_executor_globals executor_globals; static void zend_duplicate_property_info(zend_property_info *property_info) /* {{{ */ { - TSRMLS_FETCH(); - - if (UG(unicode)) { - property_info->name.u = eustrndup(property_info->name.u, property_info->name_length); - if (property_info->doc_comment.u) { - property_info->doc_comment.u = eustrndup(property_info->doc_comment.u, property_info->doc_comment_len); - } - } else { - property_info->name.s = estrndup(property_info->name.s, property_info->name_length); - if (property_info->doc_comment.s) { - property_info->doc_comment.s = estrndup(property_info->doc_comment.s, property_info->doc_comment_len); - } + property_info->name.u = eustrndup(property_info->name.u, property_info->name_length); + if (property_info->doc_comment.u) { + property_info->doc_comment.u = eustrndup(property_info->doc_comment.u, property_info->doc_comment_len); } } /* }}} */ static void zend_duplicate_property_info_internal(zend_property_info *property_info) /* {{{ */ { - TSRMLS_FETCH(); - - if (UG(unicode)) { - property_info->name.u = zend_ustrndup(property_info->name.u, property_info->name_length); - } else { - property_info->name.s = zend_strndup(property_info->name.s, property_info->name_length); - } + property_info->name.u = zend_ustrndup(property_info->name.u, property_info->name_length); } /* }}} */ @@ -401,7 +386,7 @@ void fetch_simple_variable_ex(znode *result, znode *varname, int bp, zend_uchar if (varname->op_type == IS_CONST) { if (Z_TYPE(varname->u.constant) != IS_STRING && Z_TYPE(varname->u.constant) != IS_UNICODE) { - convert_to_text(&varname->u.constant); + convert_to_unicode(&varname->u.constant); } is_auto_global = zend_u_is_auto_global_ex(Z_TYPE(varname->u.constant), Z_UNIVAL(varname->u.constant), Z_UNILEN(varname->u.constant), 0, &auto_global TSRMLS_CC); if (!is_auto_global && @@ -1315,27 +1300,17 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n unsigned int short_class_name_length; zstr short_class_lcname; - if (UG(unicode)) { - if ((short_class_name.u = u_memrchr(CG(active_class_entry)->name.u, '\\', CG(active_class_entry)->name_length))) { - short_class_name_length = CG(active_class_entry)->name_length - (short_class_name.u - CG(active_class_entry)->name.u) - 1; - short_class_name.u++; - } else { - short_class_name = CG(active_class_entry)->name; - short_class_name_length = CG(active_class_entry)->name_length; - } + if ((short_class_name.u = u_memrchr(CG(active_class_entry)->name.u, '\\', CG(active_class_entry)->name_length))) { + short_class_name_length = CG(active_class_entry)->name_length - (short_class_name.u - CG(active_class_entry)->name.u) - 1; + short_class_name.u++; } else { - if ((short_class_name.s = zend_memrchr(CG(active_class_entry)->name.s, '\\', CG(active_class_entry)->name_length))) { - short_class_name_length = CG(active_class_entry)->name_length - (short_class_name.s - CG(active_class_entry)->name.s) - 1; - short_class_name.s++; - } else { - short_class_name = CG(active_class_entry)->name; - short_class_name_length = CG(active_class_entry)->name_length; - } + short_class_name = CG(active_class_entry)->name; + short_class_name_length = CG(active_class_entry)->name_length; } - short_class_lcname = zend_u_str_case_fold(UG(unicode)?IS_UNICODE:IS_STRING, short_class_name, short_class_name_length, 0, &short_class_name_length); + short_class_lcname = zend_u_str_case_fold(IS_UNICODE, short_class_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_lcname.v, lcname.v, UG(unicode)?UBYTES(lcname_len):lcname_len))) { + if ((short_class_name_length == name_len) && (!memcmp(short_class_lcname.v, lcname.v, UBYTES(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 { @@ -1519,17 +1494,9 @@ void zend_do_end_function_declaration(const znode *function_token TSRMLS_DC) /* /* 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)) { - utype = IS_UNICODE; - 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.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.s = lcname_buf; - } + utype = IS_UNICODE; + 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); 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) { @@ -1556,7 +1523,7 @@ void zend_do_receive_arg(zend_uchar op, const znode *var, const znode *offset, c zend_arg_info *cur_arg_info; if (class_type->op_type == IS_CONST && - Z_TYPE(class_type->u.constant) == ZEND_STR_TYPE && + Z_TYPE(class_type->u.constant) == IS_UNICODE && Z_UNILEN(class_type->u.constant) == 0) { /* Usage of namespace as class name not in namespace */ zval_dtor(&class_type->u.constant); @@ -1614,7 +1581,7 @@ void zend_do_receive_arg(zend_uchar op, const znode *var, const znode *offset, c if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && Z_UNILEN(initialization->u.constant) == sizeof("null") - 1 && - ZEND_U_CASE_EQUAL(UG(unicode)?IS_UNICODE:IS_STRING, Z_UNIVAL(initialization->u.constant), Z_UNILEN(initialization->u.constant), "null", sizeof("null")-1))) { + ZEND_U_CASE_EQUAL(IS_UNICODE, Z_UNIVAL(initialization->u.constant), Z_UNILEN(initialization->u.constant), "null", sizeof("null")-1))) { cur_arg_info->allow_null = 1; } else { zend_error(E_COMPILE_ERROR, "Default value for parameters with a class type hint can only be NULL"); @@ -1628,7 +1595,7 @@ void zend_do_receive_arg(zend_uchar op, const znode *var, const znode *offset, c if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && Z_UNILEN(initialization->u.constant) == sizeof("null") - 1 && - ZEND_U_CASE_EQUAL(UG(unicode)?IS_UNICODE:IS_STRING, Z_UNIVAL(initialization->u.constant), Z_UNILEN(initialization->u.constant), "null", sizeof("null")-1))) { + ZEND_U_CASE_EQUAL(IS_UNICODE, Z_UNIVAL(initialization->u.constant), Z_UNILEN(initialization->u.constant), "null", sizeof("null")-1))) { cur_arg_info->allow_null = 1; } else if (Z_TYPE(initialization->u.constant) != IS_ARRAY && Z_TYPE(initialization->u.constant) != IS_CONSTANT_ARRAY) { zend_error(E_COMPILE_ERROR, "Default value for parameters with array type hint can only be an array or NULL"); @@ -1987,7 +1954,7 @@ void zend_do_fetch_class(znode *result, znode *class_name TSRMLS_DC) /* {{{ */ zend_op *opline; if (class_name->op_type == IS_CONST && - Z_TYPE(class_name->u.constant) == ZEND_STR_TYPE && + Z_TYPE(class_name->u.constant) == IS_UNICODE && Z_UNILEN(class_name->u.constant) == 0) { /* Usage of namespace as class name not in namespace */ zval_dtor(&class_name->u.constant); @@ -2164,7 +2131,7 @@ void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC) /* {{ zend_error(E_DEPRECATED, "Call-time pass-by-reference has been deprecated; " "if you would like to pass argument by reference, modify the declaration of %R().", - UG(unicode)?IS_UNICODE:IS_STRING, + IS_UNICODE, function_ptr->common.function_name.v); } else{ zend_error(E_DEPRECATED, @@ -2494,7 +2461,7 @@ 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) { + } else if (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)); @@ -2581,13 +2548,13 @@ static void do_inherit_parent_constructor(zend_class_entry *ce TSRMLS_DC) /* {{{ if (!zend_ascii_hash_exists(&ce->function_table, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME))) { unsigned int lc_parent_class_name_len; zend_function *function; - zstr lc_parent_class_name = zend_u_str_case_fold(ZEND_STR_TYPE, ce->parent->name, ce->parent->name_length, 0, &lc_parent_class_name_len); + zstr lc_parent_class_name = zend_u_str_case_fold(IS_UNICODE, ce->parent->name, ce->parent->name_length, 0, &lc_parent_class_name_len); - if (!zend_u_hash_exists(&ce->function_table, ZEND_STR_TYPE, lc_parent_class_name, ce->parent->name_length+1) && - zend_u_hash_find(&ce->parent->function_table, ZEND_STR_TYPE, lc_parent_class_name, ce->parent->name_length+1, (void **)&function)==SUCCESS) { + if (!zend_u_hash_exists(&ce->function_table, IS_UNICODE, lc_parent_class_name, ce->parent->name_length+1) && + zend_u_hash_find(&ce->parent->function_table, IS_UNICODE, lc_parent_class_name, ce->parent->name_length+1, (void **)&function)==SUCCESS) { if (function->common.fn_flags & ZEND_ACC_CTOR) { /* inherit parent's constructor */ - zend_u_hash_update(&ce->function_table, ZEND_STR_TYPE, lc_parent_class_name, ce->parent->name_length+1, function, sizeof(zend_function), NULL); + zend_u_hash_update(&ce->function_table, IS_UNICODE, lc_parent_class_name, ce->parent->name_length+1, function, sizeof(zend_function), NULL); function_add_ref(function TSRMLS_CC); } } @@ -2659,19 +2626,15 @@ static zend_bool zend_do_perform_implementation_check(const zend_function *fe, c } if (fe->common.arg_info[i].class_name.v && (fe->common.arg_info[i].class_name_len != proto->common.arg_info[i].class_name_len || - (!UG(unicode) && zend_binary_strcasecmp(fe->common.arg_info[i].class_name.s, fe->common.arg_info[i].class_name_len, proto->common.arg_info[i].class_name.s, proto->common.arg_info[i].class_name_len) != 0) || - (UG(unicode) && zend_u_binary_strcasecmp(fe->common.arg_info[i].class_name.u, fe->common.arg_info[i].class_name_len, proto->common.arg_info[i].class_name.u, proto->common.arg_info[i].class_name_len) != 0))) { - + (zend_u_binary_strcasecmp(fe->common.arg_info[i].class_name.u, fe->common.arg_info[i].class_name_len, proto->common.arg_info[i].class_name.u, proto->common.arg_info[i].class_name_len) != 0))) { zstr colon; if (fe->common.type != ZEND_USER_FUNCTION || - ((!UG(unicode) || - u_strchr(proto->common.arg_info[i].class_name.u, ':') != NULL || + ((u_strchr(proto->common.arg_info[i].class_name.u, ':') != NULL || (colon.u = u_memrchr(fe->common.arg_info[i].class_name.u, ':', fe->common.arg_info[i].class_name_len)) == NULL || fe->common.arg_info[i].class_name_len - (colon.u + 1 - fe->common.arg_info[i].class_name.u) != proto->common.arg_info[i].class_name_len || zend_u_binary_strcasecmp(colon.u + 1, proto->common.arg_info[i].class_name_len, proto->common.arg_info[i].class_name.u, proto->common.arg_info[i].class_name_len) != 0) && - (UG(unicode) || - strchr(proto->common.arg_info[i].class_name.s, ':') != NULL || + (strchr(proto->common.arg_info[i].class_name.s, ':') != NULL || (colon.s = zend_memrchr(fe->common.arg_info[i].class_name.s, ':', fe->common.arg_info[i].class_name_len)) == NULL || fe->common.arg_info[i].class_name_len - (colon.s + 1 - fe->common.arg_info[i].class_name.s) != proto->common.arg_info[i].class_name_len || zend_binary_strcasecmp(colon.s + 1, proto->common.arg_info[i].class_name_len, proto->common.arg_info[i].class_name.s, proto->common.arg_info[i].class_name_len) != 0))) { @@ -2785,7 +2748,7 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro zend_uchar utype; TSRMLS_FETCH(); - utype = UG(unicode)?IS_UNICODE:IS_STRING; + utype = IS_UNICODE; if (parent_info->flags & (ZEND_ACC_PRIVATE|ZEND_ACC_SHADOW)) { 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; @@ -3517,7 +3480,7 @@ void zend_do_begin_class_declaration(const znode *class_token, znode *class_name zstr tmp = zend_u_str_case_fold(Z_TYPE_PP(ns_name), Z_UNIVAL_PP(ns_name), Z_UNILEN_PP(ns_name), 0, &tmp_len); if (tmp_len != lcname_len || - memcmp(tmp.v, lcname.v, UG(unicode)?UBYTES(lcname_len):lcname_len)) { + memcmp(tmp.v, lcname.v, UBYTES(lcname_len))) { zend_error(E_COMPILE_ERROR, "Cannot declare class %R because the name is already in use", Z_TYPE(class_name->u.constant), Z_UNIVAL(class_name->u.constant)); } efree(tmp.v); @@ -4249,7 +4212,6 @@ void zend_do_add_array_element(znode *result, const znode *expr, const znode *of void zend_do_add_static_array_element(znode *result, znode *offset, const znode *expr) /* {{{ */ { zval *element; - TSRMLS_FETCH(); ALLOC_ZVAL(element); *element = expr->u.constant; @@ -4260,16 +4222,12 @@ void zend_do_add_static_array_element(znode *result, znode *offset, const znode case IS_CONSTANT: /* Ugly hack to denote that this value has a constant index */ Z_TYPE_P(element) |= IS_CONSTANT_INDEX; - if (UG(unicode)) { - Z_USTRVAL(offset->u.constant) = eurealloc(Z_USTRVAL(offset->u.constant), Z_USTRLEN(offset->u.constant)+3); - Z_USTRVAL(offset->u.constant)[Z_USTRLEN(offset->u.constant)+1] = Z_TYPE(offset->u.constant); - Z_USTRVAL(offset->u.constant)[Z_USTRLEN(offset->u.constant)+2] = 0; - } else { - Z_STRVAL(offset->u.constant) = erealloc(Z_STRVAL(offset->u.constant), Z_STRLEN(offset->u.constant)+3); - Z_STRVAL(offset->u.constant)[Z_STRLEN(offset->u.constant)+1] = Z_TYPE(offset->u.constant); - Z_STRVAL(offset->u.constant)[Z_STRLEN(offset->u.constant)+2] = 0; - } - zend_u_symtable_update(result->u.constant.value.ht, ZEND_STR_TYPE, Z_UNIVAL(offset->u.constant), Z_UNILEN(offset->u.constant)+3, &element, sizeof(zval *), NULL); + + Z_USTRVAL(offset->u.constant) = eurealloc(Z_USTRVAL(offset->u.constant), Z_USTRLEN(offset->u.constant)+3); + Z_USTRVAL(offset->u.constant)[Z_USTRLEN(offset->u.constant)+1] = Z_TYPE(offset->u.constant); + Z_USTRVAL(offset->u.constant)[Z_USTRLEN(offset->u.constant)+2] = 0; + + zend_u_symtable_update(result->u.constant.value.ht, IS_UNICODE, Z_UNIVAL(offset->u.constant), Z_UNILEN(offset->u.constant)+3, &element, sizeof(zval *), NULL); zval_dtor(&offset->u.constant); break; case IS_STRING: @@ -4278,7 +4236,7 @@ void zend_do_add_static_array_element(znode *result, znode *offset, const znode zval_dtor(&offset->u.constant); break; case IS_NULL: - zend_u_symtable_update(Z_ARRVAL(result->u.constant), ZEND_STR_TYPE, EMPTY_ZSTR, 1, &element, sizeof(zval *), NULL); + zend_u_symtable_update(Z_ARRVAL(result->u.constant), IS_UNICODE, EMPTY_ZSTR, 1, &element, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: @@ -4415,7 +4373,7 @@ void zend_do_fetch_static_variable(znode *varname, const znode *static_assignmen if (varname->op_type == IS_CONST) { if (Z_TYPE(varname->u.constant) != IS_STRING && Z_TYPE(varname->u.constant) != IS_UNICODE) { - convert_to_text(&varname->u.constant); + convert_to_unicode(&varname->u.constant); } } @@ -4453,7 +4411,7 @@ void zend_do_fetch_lexical_variable(znode *varname, zend_bool is_ref TSRMLS_DC) znode value; if (Z_UNILEN(varname->u.constant) == sizeof("this") - 1 && - ZEND_U_EQUAL(UG(unicode)?IS_UNICODE:IS_STRING, Z_UNIVAL(varname->u.constant), Z_UNILEN(varname->u.constant), "this", sizeof("this")-1)) { + ZEND_U_EQUAL(IS_UNICODE, Z_UNIVAL(varname->u.constant), Z_UNILEN(varname->u.constant), "this", sizeof("this")-1)) { zend_error(E_COMPILE_ERROR, "Cannot use $this as lexical variable"); return; } @@ -4477,7 +4435,7 @@ void zend_do_fetch_global_variable(znode *varname, const znode *static_assignmen if (varname->op_type == IS_CONST) { if (Z_TYPE(varname->u.constant) != IS_STRING && Z_TYPE(varname->u.constant) != IS_UNICODE) { - convert_to_text(&varname->u.constant); + convert_to_unicode(&varname->u.constant); } } @@ -4834,7 +4792,7 @@ void zend_do_declare_stmt(znode *var, znode *val TSRMLS_DC) /* {{{ */ if (ZEND_U_EQUAL(Z_TYPE(var->u.constant), Z_UNIVAL(var->u.constant), Z_UNILEN(var->u.constant), "ticks", sizeof("ticks")-1)) { convert_to_long(&val->u.constant); CG(declarables).ticks = val->u.constant; - } else if (UG(unicode) && ZEND_U_EQUAL(Z_TYPE(var->u.constant), Z_UNIVAL(var->u.constant), Z_UNILEN(var->u.constant), "encoding", sizeof("encoding")-1)) { + } else if (ZEND_U_EQUAL(Z_TYPE(var->u.constant), Z_UNIVAL(var->u.constant), Z_UNILEN(var->u.constant), "encoding", sizeof("encoding")-1)) { UErrorCode status = U_ZERO_ERROR; if ((Z_TYPE(val->u.constant) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { @@ -5192,7 +5150,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, UG(unicode)?ZEND_U_FUNCTION_DTOR:ZEND_FUNCTION_DTOR, persistent_hashes, UG(unicode), 0); + zend_u_hash_init_ex(&ce->function_table, 0, NULL, ZEND_U_FUNCTION_DTOR, persistent_hashes, UG(unicode), 0); if (ce->type == ZEND_INTERNAL_CLASS) { #ifdef ZTS @@ -5271,10 +5229,6 @@ void zend_do_normalization(znode *result, znode *str TSRMLS_DC) /* {{{ */ { zend_op *opline; - if (!UG(unicode)) { - *result = *str; - return; - } opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_U_NORMALIZE; opline->result.op_type = IS_TMP_VAR; @@ -5395,7 +5349,7 @@ void zend_do_build_namespace_name(znode *result, znode *prefix, znode *name TSRM { if (prefix) { *result = *prefix; - if (Z_TYPE(result->u.constant) == ZEND_STR_TYPE && + if (Z_TYPE(result->u.constant) == IS_UNICODE && Z_UNILEN(result->u.constant) == 0) { /* namespace\ */ if (CG(current_namespace)) { @@ -5410,7 +5364,7 @@ void zend_do_build_namespace_name(znode *result, znode *prefix, znode *name TSRM } } else { result->op_type = IS_CONST; - Z_TYPE(result->u.constant) = ZEND_STR_TYPE; + Z_TYPE(result->u.constant) = IS_UNICODE; Z_UNIVAL(result->u.constant) = NULL_ZSTR; Z_UNILEN(result->u.constant) = 0; } @@ -5507,27 +5461,17 @@ void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{ if (new_name) { name = &new_name->u.constant; } else { + UChar *p = u_memrchr(Z_USTRVAL_P(ns), '\\', Z_USTRLEN_P(ns)); /* The form "use A\B" is eqivalent to "use A\B as B". So we extract the last part of compound name to use as a new_name */ name = &tmp; - if (UG(unicode)) { - UChar *p = u_memrchr(Z_USTRVAL_P(ns), '\\', Z_USTRLEN_P(ns)); - if (p) { - ZVAL_UNICODE(name, p+1, 1); - } else { - *name = *ns; - zval_copy_ctor(name); - warn = !is_global && !CG(current_namespace); - } + + if (p) { + ZVAL_UNICODE(name, p+1, 1); } else { - char *p = zend_memrchr(Z_STRVAL_P(ns), '\\', Z_STRLEN_P(ns)); - if (p) { - ZVAL_STRING(name, p+1, 1); - } else { - *name = *ns; - zval_copy_ctor(name); - warn = !is_global && !CG(current_namespace); - } + *name = *ns; + zval_copy_ctor(name); + warn = !is_global && !CG(current_namespace); } } @@ -5559,7 +5503,7 @@ void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{ zstr tmp = zend_u_str_case_fold(Z_TYPE_P(ns), Z_UNIVAL_P(ns), Z_UNILEN_P(ns), 0, &tmp_len); if (tmp_len != ns_name_len + 1 + lcname_len || - memcmp(tmp.v, ns_name.v, UG(unicode)?UBYTES(tmp_len):tmp_len)) { + memcmp(tmp.v, ns_name.v, UBYTES(tmp_len))) { zend_error(E_COMPILE_ERROR, "Cannot use %R as %R because the name is already in use", Z_TYPE_P(ns), Z_UNIVAL_P(ns), Z_TYPE_P(name), Z_UNIVAL_P(name)); } efree(tmp.v); @@ -5572,7 +5516,7 @@ void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{ zstr tmp = zend_u_str_case_fold(Z_TYPE_P(ns), Z_UNIVAL_P(ns), Z_UNILEN_P(ns), 0, &tmp_len); if (tmp_len != lcname_len || - memcmp(tmp.v, lcname.v, UG(unicode)?UBYTES(tmp_len):tmp_len)) { + memcmp(tmp.v, lcname.v, UBYTES(tmp_len))) { zend_error(E_COMPILE_ERROR, "Cannot use %R as %R because the name is already in use", Z_TYPE_P(ns), Z_UNIVAL_P(ns), Z_TYPE_P(name), Z_UNIVAL_P(name)); } efree(tmp.v); diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c index d89ce23544..2b08ff8b7b 100644 --- a/Zend/zend_constants.c +++ b/Zend/zend_constants.c @@ -38,11 +38,9 @@ void free_zend_constant(zend_constant *c) /* {{{ */ void copy_zend_constant(zend_constant *c) /* {{{ */ { TSRMLS_FETCH(); - if (UG(unicode)) { - c->name.u = zend_ustrndup(c->name.u, c->name_len - 1); - } else { - c->name.s = zend_strndup(c->name.s, c->name_len - 1); - } + + c->name.u = zend_ustrndup(c->name.u, c->name_len - 1); + if (!(c->flags & CONST_PERSISTENT)) { zval_copy_ctor(&c->value); } @@ -192,19 +190,15 @@ ZEND_API void zend_register_long_constant(const char *name, uint name_len, long { 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; - } + 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_LONG; Z_LVAL(c.value) = lval; c.flags = flags; c.module_number = module_number; - zend_u_register_constant(ZEND_STR_TYPE, &c TSRMLS_CC); + zend_u_register_constant(IS_UNICODE, &c TSRMLS_CC); } /* }}} */ @@ -212,19 +206,15 @@ ZEND_API void zend_register_double_constant(const char *name, uint name_len, dou { 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; - } + 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_DOUBLE; Z_DVAL(c.value) = dval; c.flags = flags; c.module_number = module_number; - zend_u_register_constant(ZEND_STR_TYPE, &c TSRMLS_CC); + zend_u_register_constant(IS_UNICODE, &c TSRMLS_CC); } /* }}} */ @@ -232,31 +222,24 @@ ZEND_API void zend_register_stringl_constant(const char *name, uint name_len, ch { 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; - 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); - } + 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 { - 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; + 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); + } + c.flags = flags; c.module_number = module_number; - zend_u_register_constant(ZEND_STR_TYPE, &c TSRMLS_CC); + zend_u_register_constant(IS_UNICODE, &c TSRMLS_CC); } /* }}} */ @@ -573,26 +556,22 @@ ZEND_API int zend_u_register_constant(zend_uchar type, zend_constant *c TSRMLS_D ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC) /* {{{ */ { - if (UG(unicode)) { - UChar *ustr; - - if (c->name.s) { - ustr = malloc(UBYTES(c->name_len)); - u_charsToUChars(c->name.s, ustr, c->name_len); - free(c->name.s); - c->name.u = ustr; - } - if (Z_TYPE(c->value) == IS_STRING || (Z_TYPE(c->value) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { - ustr = pemalloc(UBYTES(Z_STRLEN(c->value)+1), c->flags & CONST_PERSISTENT); - u_charsToUChars(Z_STRVAL(c->value), ustr, Z_STRLEN(c->value)+1); - pefree(Z_STRVAL(c->value), c->flags & CONST_PERSISTENT); - Z_USTRVAL(c->value) = ustr; - if (Z_TYPE(c->value) == IS_STRING) Z_TYPE(c->value) = IS_UNICODE; - } - return zend_u_register_constant(IS_UNICODE, c TSRMLS_CC); - } else { - return zend_u_register_constant(IS_STRING, c TSRMLS_CC); + UChar *ustr; + + if (c->name.s) { + ustr = malloc(UBYTES(c->name_len)); + u_charsToUChars(c->name.s, ustr, c->name_len); + free(c->name.s); + c->name.u = ustr; + } + if (Z_TYPE(c->value) == IS_STRING || (Z_TYPE(c->value) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { + ustr = pemalloc(UBYTES(Z_STRLEN(c->value)+1), c->flags & CONST_PERSISTENT); + u_charsToUChars(Z_STRVAL(c->value), ustr, Z_STRLEN(c->value)+1); + pefree(Z_STRVAL(c->value), c->flags & CONST_PERSISTENT); + Z_USTRVAL(c->value) = ustr; + if (Z_TYPE(c->value) == IS_STRING) Z_TYPE(c->value) = IS_UNICODE; } + return zend_u_register_constant(IS_UNICODE, c TSRMLS_CC); } /* }}} */ diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index ee638b8c8a..fb858f0f52 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -485,21 +485,17 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z zstr class_name; zend_uint class_name_len; int dup; + zval tmp; TRACE_APPEND_STR("Object("); - dup = zend_get_object_classname(*arg, &class_name, &class_name_len TSRMLS_CC); + dup = zend_get_object_classname(*arg, &class_name, &class_name_len TSRMLS_CC); - if (UG(unicode)) { - zval tmp; - - 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.s, class_name_len); - } + 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); + if(!dup) { efree(class_name.v); } diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index f40505b33a..40f313be3e 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -243,7 +243,7 @@ static zend_always_inline zval *_get_zval_ptr_var(const znode *node, const temp_ static zval **_get_zval_cv_lookup(zval ***ptr, zend_uint var, int type TSRMLS_DC) /* {{{ */ { zend_compiled_variable *cv = &CV_DEF_OF(var); - zend_uchar utype = UG(unicode)?IS_UNICODE:IS_STRING; + zend_uchar utype = IS_UNICODE; if (!EG(active_symbol_table) || zend_u_hash_quick_find(EG(active_symbol_table), utype, cv->name, cv->name_len+1, cv->hash_value, (void **)ptr)==FAILURE) { @@ -482,7 +482,7 @@ static inline void make_real_object(zval **object_ptr TSRMLS_DC) /* {{{ */ static inline char * zend_verify_arg_class_kind(zend_arg_info *cur_arg_info, ulong fetch_type, zstr *class_name, zend_class_entry **pce TSRMLS_DC) /* {{{ */ { - *pce = zend_u_fetch_class(UG(unicode) ? IS_UNICODE : IS_STRING, cur_arg_info->class_name, cur_arg_info->class_name_len, (fetch_type | ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD) TSRMLS_CC); + *pce = zend_u_fetch_class(IS_UNICODE, cur_arg_info->class_name, cur_arg_info->class_name_len, (fetch_type | ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD) TSRMLS_CC); *class_name = (*pce) ? (*pce)->name: cur_arg_info->class_name; if (*pce && (*pce)->ce_flags & ZEND_ACC_INTERFACE) { @@ -650,7 +650,7 @@ static inline void zend_assign_to_object(znode *result, zval **object_ptr, zval static inline int zend_assign_to_string_offset(const temp_variable *T, const zval *value, int value_type TSRMLS_DC) /* {{{ */ { - if (UG(unicode) && Z_TYPE_P(T->str_offset.str) == IS_STRING && Z_TYPE_P(value) != IS_STRING) { + if (Z_TYPE_P(T->str_offset.str) == IS_STRING && Z_TYPE_P(value) != IS_STRING) { convert_to_unicode(T->str_offset.str); } @@ -877,7 +877,7 @@ static inline zval **zend_fetch_dimension_address_inner(HashTable *ht, const zva switch (ztype) { case IS_NULL: - ztype = ZEND_STR_TYPE; + ztype = IS_UNICODE; offset_key = EMPTY_ZSTR; offset_key_length = 0; goto fetch_string_dim; @@ -889,7 +889,7 @@ static inline zval **zend_fetch_dimension_address_inner(HashTable *ht, const zva offset_key_length = Z_UNILEN_P(dim); fetch_string_dim: - if (UG(unicode) && ht == &EG(symbol_table) && ztype == IS_UNICODE) { + if (ht == &EG(symbol_table) && ztype == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int norm_len; diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 4338d1f1d8..2042a19a44 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -403,10 +403,8 @@ ZEND_API zstr get_active_function_name(TSRMLS_D) /* {{{ */ if (function_name.v) { return function_name; - } else if (UG(unicode)) { - ret.u = u_main; } else { - ret.s = "main"; + ret.u = u_main; } return ret; } @@ -533,22 +531,20 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco refcount = Z_REFCOUNT_P(p); is_ref = Z_ISREF_P(p); - if (!zend_u_get_constant_ex(ZEND_STR_TYPE, Z_UNIVAL_P(p), Z_UNILEN_P(p), &const_value, scope, Z_REAL_TYPE_P(p) TSRMLS_CC)) { + if (!zend_u_get_constant_ex(IS_UNICODE, Z_UNIVAL_P(p), Z_UNILEN_P(p), &const_value, scope, Z_REAL_TYPE_P(p) TSRMLS_CC)) { zstr actual = Z_UNIVAL_P(p); - if ((UG(unicode) && (colon.u = u_memrchr(Z_USTRVAL_P(p), ':', Z_USTRLEN_P(p))) && colon.u > Z_USTRVAL_P(p) && *(colon.u - 1) == ':') || - (!UG(unicode) && (colon.s = zend_memrchr(Z_STRVAL_P(p), ':', Z_STRLEN_P(p))) && colon.s > Z_STRVAL_P(p) && *(colon.s - 1) == ':') - ) { + if ((colon.u = u_memrchr(Z_USTRVAL_P(p), ':', Z_USTRLEN_P(p))) && colon.u > Z_USTRVAL_P(p) && *(colon.u - 1) == ':') { zend_error(E_ERROR, "Undefined class constant '%v'", actual); } else { zstr save = actual, slash; int actual_len = Z_UNILEN_P(p); - if(ZEND_STR_TYPE == IS_UNICODE) { + if(IS_UNICODE == IS_UNICODE) { slash.u = u_memrchr(actual.u, '\\', actual_len); } else { slash.s = zend_memrchr(actual.s, '\\', actual_len); } if ((Z_TYPE_P(p) & IS_CONSTANT_UNQUALIFIED) && slash.v != NULL) { - if(ZEND_STR_TYPE == IS_UNICODE) { + if(IS_UNICODE == IS_UNICODE) { actual.u = slash.u + 1; actual_len -= (actual.u - Z_USTRVAL_P(p)); } else { @@ -558,12 +554,12 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco if (inline_change) { int type = Z_TYPE_P(p); - ZVAL_ZSTRL(p, ZEND_STR_TYPE, actual, actual_len, 1); + ZVAL_ZSTRL(p, IS_UNICODE, actual, actual_len, 1); Z_TYPE_P(p) = type; actual = Z_UNIVAL_P(p); } } - if(ZEND_STR_TYPE == IS_UNICODE && actual.u[0] == '\\') { + if(IS_UNICODE == IS_UNICODE && actual.u[0] == '\\') { if (inline_change) { memmove(Z_USTRVAL_P(p), Z_USTRVAL_P(p)+1, UBYTES(Z_USTRLEN_P(p))); --Z_USTRLEN_P(p); @@ -571,7 +567,7 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco ++actual.u; } --actual_len; - } else if(ZEND_STR_TYPE == IS_STRING && actual.s[0] == '\\') { + } else if(IS_UNICODE == IS_STRING && actual.s[0] == '\\') { if (inline_change) { memmove(Z_STRVAL_P(p), Z_STRVAL_P(p)+1, Z_STRLEN_P(p)); --Z_STRLEN_P(p); @@ -582,16 +578,16 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco } if ((Z_TYPE_P(p) & IS_CONSTANT_UNQUALIFIED) == 0) { int fix_save = 0; - if (ZEND_STR_TYPE == IS_UNICODE && save.u[0] == '\\') { + if (IS_UNICODE == IS_UNICODE && save.u[0] == '\\') { save.u++; fix_save = 1; - } else if (ZEND_STR_TYPE == IS_STRING && save.s[0] == '\\') { + } else if (IS_UNICODE == IS_STRING && save.s[0] == '\\') { save.s++; fix_save = 1; } zend_error(E_ERROR, "Undefined constant '%v'", save); if (fix_save) { - (ZEND_STR_TYPE == IS_UNICODE)?--save.u:--save.s; + --save.u; } if (inline_change) { efree(save.v); @@ -602,7 +598,7 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco efree(save.v); } zend_error(E_NOTICE, "Use of undefined constant %v - assumed '%v'", actual, actual); - Z_TYPE_P(p) = UG(unicode) ? IS_UNICODE : IS_STRING; + Z_TYPE_P(p) = IS_UNICODE; if (!inline_change) { ZVAL_ZSTRL(p, Z_TYPE_P(p), actual, actual_len, 0); zval_copy_ctor(p); @@ -646,60 +642,33 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco continue; } Z_TYPE_PP(element) &= ~IS_CONSTANT_INDEX; - if (zend_hash_get_current_key_ex(Z_ARRVAL_P(p), &str_index, &str_index_len, &num_index, 0, NULL) != (UG(unicode) ? HASH_KEY_IS_UNICODE : HASH_KEY_IS_STRING)) { + if (zend_hash_get_current_key_ex(Z_ARRVAL_P(p), &str_index, &str_index_len, &num_index, 0, NULL) != HASH_KEY_IS_UNICODE) { zend_hash_move_forward(Z_ARRVAL_P(p)); continue; } - if (!zend_u_get_constant_ex(ZEND_STR_TYPE, str_index, str_index_len - 3, &const_value, scope, (UG(unicode) ? str_index.u[str_index_len-2] : str_index.s[str_index_len-2]) TSRMLS_CC)) { - if (UG(unicode)) { - UChar *actual, *save = str_index.u; - if ((colon.u = u_memrchr(str_index.u, ':', str_index_len - 3)) && colon.u > str_index.u && *(colon.u-1) == ':') { - zend_error(E_ERROR, "Undefined class constant '%v'", str_index); - str_index_len -= ((colon.u - str_index.u) + 1); - str_index.u = colon.u + 1; - } else { - if (str_index.u[str_index_len - 2] & IS_CONSTANT_UNQUALIFIED) { - if ((actual = (UChar *)u_memrchr(str_index.u, '\\', str_index_len - 3))) { - actual++; - str_index_len -= (actual - str_index.u); - str_index.u = actual; - } - } - if (str_index.u[0] == '\\') { - ++str_index.u; - --str_index_len; - } - if (save[0] == '\\') { - ++save; - } - if ((str_index.u[str_index_len - 2] & IS_CONSTANT_UNQUALIFIED) == 0) { - zend_error(E_ERROR, "Undefined constant '%r'", save); - } - } + if (!zend_u_get_constant_ex(IS_UNICODE, str_index, str_index_len - 3, &const_value, scope, str_index.u[str_index_len-2] TSRMLS_CC)) { + UChar *actual, *save = str_index.u; + if ((colon.u = u_memrchr(str_index.u, ':', str_index_len - 3)) && colon.u > str_index.u && *(colon.u-1) == ':') { + zend_error(E_ERROR, "Undefined class constant '%v'", str_index); + str_index_len -= ((colon.u - str_index.u) + 1); + str_index.u = colon.u + 1; } else { - char *actual, *save = str_index.s; - if ((colon.s = zend_memrchr(str_index.s, ':', str_index_len - 3)) && colon.s > str_index.s && *(colon.s-1) == ':') { - zend_error(E_ERROR, "Undefined class constant '%v'", str_index); - str_index_len -= ((colon.s - str_index.s) + 1); - str_index.s = colon.s + 1; - } else { - if (str_index.s[str_index_len - 2] & IS_CONSTANT_UNQUALIFIED) { - if ((actual = (char *)zend_memrchr(str_index.s, '\\', str_index_len - 3))) { - actual++; - str_index_len -= (actual - str_index.s); - str_index.s = actual; - } - } - if (str_index.s[0] == '\\') { - ++str_index.s; - --str_index_len; - } - if (save[0] == '\\') { - ++save; - } - if ((str_index.s[str_index_len - 2] & IS_CONSTANT_UNQUALIFIED) == 0) { - zend_error(E_ERROR, "Undefined constant '%s'", save); - } + if (str_index.u[str_index_len - 2] & IS_CONSTANT_UNQUALIFIED) { + if ((actual = (UChar *)u_memrchr(str_index.u, '\\', str_index_len - 3))) { + actual++; + str_index_len -= (actual - str_index.u); + str_index.u = actual; + } + } + if (str_index.u[0] == '\\') { + ++str_index.u; + --str_index_len; + } + if (save[0] == '\\') { + ++save; + } + if ((str_index.u[str_index_len - 2] & IS_CONSTANT_UNQUALIFIED) == 0) { + zend_error(E_ERROR, "Undefined constant '%r'", save); } } zend_error(E_NOTICE, "Use of undefined constant %v - assumed '%v'", str_index, str_index); @@ -1176,9 +1145,7 @@ ZEND_API int zend_u_lookup_class_ex(zend_uchar type, zstr name, int name_length, EG(autoload_func) = fcall_cache.function_handler; - if (UG(unicode)) { - zval_dtor(&autoload_function); - } + zval_dtor(&autoload_function); zval_ptr_dtor(&class_name_ptr); @@ -1781,7 +1748,7 @@ ZEND_API int zend_delete_global_variable(char *name, int name_len TSRMLS_DC) /* ZEND_API void zend_rebuild_symbol_table(TSRMLS_D) /* {{{ */ { - zend_uchar type = ZEND_STR_TYPE; + zend_uchar type = IS_UNICODE; zend_uint i; zend_execute_data *ex; diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index ea690e9ed2..8f4ed348a0 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -331,71 +331,54 @@ ZEND_API int _zend_hash_add_or_update(HashTable *ht, const char *arKey, uint nKe ZEND_API int _zend_ascii_hash_add_or_update(HashTable *ht, const char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) /* {{{ */ { + zstr key; + int ret; TSRMLS_FETCH(); - if (UG(unicode)) { - zstr key; - int ret; - - key.u = zend_ascii_to_unicode(arKey, nKeyLength ZEND_FILE_LINE_CC); - ret = _zend_u_hash_add_or_update(ht, IS_UNICODE, key, nKeyLength, pData, nDataSize, pDest, flag ZEND_FILE_LINE_CC); - efree(key.u); - return ret; - } else { - return _zend_u_hash_add_or_update(ht, IS_STRING, ZSTR(arKey), nKeyLength, pData, nDataSize, pDest, flag ZEND_FILE_LINE_CC); - } + key.u = zend_ascii_to_unicode(arKey, nKeyLength ZEND_FILE_LINE_CC); + ret = _zend_u_hash_add_or_update(ht, IS_UNICODE, key, nKeyLength, pData, nDataSize, pDest, flag ZEND_FILE_LINE_CC); + efree(key.u); + return ret; } /* }}} */ ZEND_API int _zend_rt_hash_add_or_update(HashTable *ht, const char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) /* {{{ */ { + zstr key; + int ret; + UErrorCode status = U_ZERO_ERROR; + int u_len; TSRMLS_FETCH(); - if (UG(unicode)) { - zstr key; - int ret; - UErrorCode status = U_ZERO_ERROR; - int u_len; - - zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &key.u, &u_len, arKey, nKeyLength-1, &status); - if (U_FAILURE(status)) { - ZEND_HASH_CVT_ERROR(); - goto string_key; - } - - ret = _zend_u_hash_add_or_update(ht, IS_UNICODE, key, u_len+1, pData, nDataSize, pDest, flag ZEND_FILE_LINE_CC); - efree(key.u); - return ret; - } else { -string_key: + zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &key.u, &u_len, arKey, nKeyLength-1, &status); + if (U_FAILURE(status)) { + ZEND_HASH_CVT_ERROR(); return _zend_u_hash_add_or_update(ht, IS_STRING, ZSTR(arKey), nKeyLength, pData, nDataSize, pDest, flag ZEND_FILE_LINE_CC); } + + ret = _zend_u_hash_add_or_update(ht, IS_UNICODE, key, u_len+1, pData, nDataSize, pDest, flag ZEND_FILE_LINE_CC); + efree(key.u); + return ret; } /* }}} */ ZEND_API int _zend_utf8_hash_add_or_update(HashTable *ht, const char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) /* {{{ */ { + zstr key; + int ret; + UErrorCode status = U_ZERO_ERROR; + int u_len; TSRMLS_FETCH(); - if (UG(unicode)) { - zstr key; - int ret; - UErrorCode status = U_ZERO_ERROR; - int u_len; - - zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(utf8_conv)), &key.u, &u_len, arKey, nKeyLength-1, &status); - if (U_FAILURE(status)) { - ZEND_HASH_CVT_ERROR(); - goto string_key; - } - - ret = _zend_u_hash_add_or_update(ht, IS_UNICODE, key, u_len+1, pData, nDataSize, pDest, flag ZEND_FILE_LINE_CC); - efree(key.u); - return ret; - } else { -string_key: + zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(utf8_conv)), &key.u, &u_len, arKey, nKeyLength-1, &status); + if (U_FAILURE(status)) { + ZEND_HASH_CVT_ERROR(); return _zend_u_hash_add_or_update(ht, IS_STRING, ZSTR(arKey), nKeyLength, pData, nDataSize, pDest, flag ZEND_FILE_LINE_CC); } + + ret = _zend_u_hash_add_or_update(ht, IS_UNICODE, key, u_len+1, pData, nDataSize, pDest, flag ZEND_FILE_LINE_CC); + efree(key.u); + return ret; } /* }}} */ @@ -688,69 +671,53 @@ ZEND_API int zend_hash_del_key_or_index(HashTable *ht, const char *arKey, uint n ZEND_API int zend_ascii_hash_del(HashTable *ht, const char *arKey, uint nKeyLength) /* {{{ */ { + zstr key; + int ret; TSRMLS_FETCH(); - if (UG(unicode)) { - zstr key; - int ret; - - key.u = zend_ascii_to_unicode(arKey, nKeyLength ZEND_FILE_LINE_CC); - ret = zend_u_hash_del_key_or_index(ht, IS_UNICODE, key, nKeyLength, 0, HASH_DEL_KEY); - efree(key.u); - return ret; - } else { - return zend_u_hash_del_key_or_index(ht, IS_STRING, ZSTR(arKey), nKeyLength, 0, HASH_DEL_KEY); - } + key.u = zend_ascii_to_unicode(arKey, nKeyLength ZEND_FILE_LINE_CC); + ret = zend_u_hash_del_key_or_index(ht, IS_UNICODE, key, nKeyLength, 0, HASH_DEL_KEY); + efree(key.u); + return ret; } /* }}} */ ZEND_API int zend_rt_hash_del(HashTable *ht, const char *arKey, uint nKeyLength) /* {{{ */ { + zstr key; + int ret; + UErrorCode status = U_ZERO_ERROR; + int u_len; TSRMLS_FETCH(); - if (UG(unicode)) { - zstr key; - int ret; - UErrorCode status = U_ZERO_ERROR; - int u_len; - - zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &key.u, &u_len, arKey, nKeyLength-1, &status); - if (U_FAILURE(status)) { - ZEND_HASH_CVT_ERROR(); - goto string_key; - } - ret = zend_u_hash_del_key_or_index(ht, IS_UNICODE, key, u_len+1, 0, HASH_DEL_KEY); - efree(key.u); - return ret; - } else { -string_key: + zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &key.u, &u_len, arKey, nKeyLength-1, &status); + if (U_FAILURE(status)) { + ZEND_HASH_CVT_ERROR(); return zend_u_hash_del_key_or_index(ht, IS_STRING, ZSTR(arKey), nKeyLength, 0, HASH_DEL_KEY); } + ret = zend_u_hash_del_key_or_index(ht, IS_UNICODE, key, u_len+1, 0, HASH_DEL_KEY); + efree(key.u); + return ret; + } /* }}} */ ZEND_API int zend_utf8_hash_del(HashTable *ht, const char *arKey, uint nKeyLength) /* {{{ */ { + zstr key; + int ret; + UErrorCode status = U_ZERO_ERROR; + int u_len; TSRMLS_FETCH(); - if (UG(unicode)) { - zstr key; - int ret; - UErrorCode status = U_ZERO_ERROR; - int u_len; - - zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(utf8_conv)), &key.u, &u_len, arKey, nKeyLength-1, &status); - if (U_FAILURE(status)) { - ZEND_HASH_CVT_ERROR(); - goto string_key; - } - ret = zend_u_hash_del_key_or_index(ht, IS_UNICODE, key, u_len+1, 0, HASH_DEL_KEY); - efree(key.u); - return ret; - } else { -string_key: + zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(utf8_conv)), &key.u, &u_len, arKey, nKeyLength-1, &status); + if (U_FAILURE(status)) { + ZEND_HASH_CVT_ERROR(); return zend_u_hash_del_key_or_index(ht, IS_STRING, ZSTR(arKey), nKeyLength, 0, HASH_DEL_KEY); } + ret = zend_u_hash_del_key_or_index(ht, IS_UNICODE, key, u_len+1, 0, HASH_DEL_KEY); + efree(key.u); + return ret; } /* }}} */ @@ -1166,69 +1133,52 @@ ZEND_API int zend_hash_find(const HashTable *ht, const char *arKey, uint nKeyLen ZEND_API int zend_ascii_hash_find(const HashTable *ht, const char *arKey, uint nKeyLength, void **pData) /* {{{ */ { + zstr key; + int ret; TSRMLS_FETCH(); - if (UG(unicode)) { - zstr key; - int ret; - - key.u = zend_ascii_to_unicode(arKey, nKeyLength ZEND_FILE_LINE_CC); - ret = zend_u_hash_find(ht, IS_UNICODE, key, nKeyLength, pData); - efree(key.u); - return ret; - } else { - return zend_u_hash_find(ht, IS_STRING, ZSTR(arKey), nKeyLength, pData); - } + key.u = zend_ascii_to_unicode(arKey, nKeyLength ZEND_FILE_LINE_CC); + ret = zend_u_hash_find(ht, IS_UNICODE, key, nKeyLength, pData); + efree(key.u); + return ret; } /* }}} */ ZEND_API int zend_rt_hash_find(const HashTable *ht, const char *arKey, uint nKeyLength, void **pData) /* {{{ */ { + zstr key; + int ret; + UErrorCode status = U_ZERO_ERROR; + int u_len; TSRMLS_FETCH(); - if (UG(unicode)) { - zstr key; - int ret; - UErrorCode status = U_ZERO_ERROR; - int u_len; - - zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &key.u, &u_len, arKey, nKeyLength-1, &status); - if (U_FAILURE(status)) { - ZEND_HASH_CVT_ERROR(); - goto string_key; - } - ret = zend_u_hash_find(ht, IS_UNICODE, key, u_len+1, pData); - efree(key.u); - return ret; - } else { -string_key: + zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &key.u, &u_len, arKey, nKeyLength-1, &status); + if (U_FAILURE(status)) { + ZEND_HASH_CVT_ERROR(); return zend_u_hash_find(ht, IS_STRING, ZSTR(arKey), nKeyLength, pData); } + ret = zend_u_hash_find(ht, IS_UNICODE, key, u_len+1, pData); + efree(key.u); + return ret; } /* }}} */ ZEND_API int zend_utf8_hash_find(const HashTable *ht, const char *arKey, uint nKeyLength, void **pData) /* {{{ */ { + zstr key; + int ret; + UErrorCode status = U_ZERO_ERROR; + int u_len; TSRMLS_FETCH(); - if (UG(unicode)) { - zstr key; - int ret; - UErrorCode status = U_ZERO_ERROR; - int u_len; - - zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(utf8_conv)), &key.u, &u_len, arKey, nKeyLength-1, &status); - if (U_FAILURE(status)) { - ZEND_HASH_CVT_ERROR(); - goto string_key; - } - ret = zend_u_hash_find(ht, IS_UNICODE, key, u_len+1, pData); - efree(key.u); - return ret; - } else { -string_key: + zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(utf8_conv)), &key.u, &u_len, arKey, nKeyLength-1, &status); + if (U_FAILURE(status)) { + ZEND_HASH_CVT_ERROR(); return zend_u_hash_find(ht, IS_STRING, ZSTR(arKey), nKeyLength, pData); } + ret = zend_u_hash_find(ht, IS_UNICODE, key, u_len+1, pData); + efree(key.u); + return ret; } /* }}} */ @@ -1316,69 +1266,52 @@ ZEND_API int zend_hash_exists(const HashTable *ht, const char *arKey, uint nKeyL ZEND_API int zend_ascii_hash_exists(HashTable *ht, const char *arKey, uint nKeyLength) /* {{{ */ { + zstr key; + int ret; TSRMLS_FETCH(); - if (UG(unicode)) { - zstr key; - int ret; - - key.u = zend_ascii_to_unicode(arKey, nKeyLength ZEND_FILE_LINE_CC); - ret = zend_u_hash_exists(ht, IS_UNICODE, key, nKeyLength); - efree(key.u); - return ret; - } else { - return zend_u_hash_exists(ht, IS_STRING, ZSTR(arKey), nKeyLength); - } + key.u = zend_ascii_to_unicode(arKey, nKeyLength ZEND_FILE_LINE_CC); + ret = zend_u_hash_exists(ht, IS_UNICODE, key, nKeyLength); + efree(key.u); + return ret; } /* }}} */ ZEND_API int zend_rt_hash_exists(HashTable *ht, const char *arKey, uint nKeyLength) /* {{{ */ { + zstr key; + int ret; + UErrorCode status = U_ZERO_ERROR; + int u_len; TSRMLS_FETCH(); - if (UG(unicode)) { - zstr key; - int ret; - UErrorCode status = U_ZERO_ERROR; - int u_len; - - zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &key.u, &u_len, arKey, nKeyLength-1, &status); - if (U_FAILURE(status)) { - ZEND_HASH_CVT_ERROR(); - goto string_key; - } - ret = zend_u_hash_exists(ht, IS_UNICODE, key, u_len+1); - efree(key.u); - return ret; - } else { -string_key: + zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &key.u, &u_len, arKey, nKeyLength-1, &status); + if (U_FAILURE(status)) { + ZEND_HASH_CVT_ERROR(); return zend_u_hash_exists(ht, IS_STRING, ZSTR(arKey), nKeyLength); - } + } + ret = zend_u_hash_exists(ht, IS_UNICODE, key, u_len+1); + efree(key.u); + return ret; } /* }}} */ ZEND_API int zend_utf8_hash_exists(HashTable *ht, const char *arKey, uint nKeyLength) /* {{{ */ { + zstr key; + int ret; + UErrorCode status = U_ZERO_ERROR; + int u_len; TSRMLS_FETCH(); - if (UG(unicode)) { - zstr key; - int ret; - UErrorCode status = U_ZERO_ERROR; - int u_len; - - zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(utf8_conv)), &key.u, &u_len, arKey, nKeyLength-1, &status); - if (U_FAILURE(status)) { - ZEND_HASH_CVT_ERROR(); - goto string_key; - } - ret = zend_u_hash_exists(ht, IS_UNICODE, key, u_len+1); - efree(key.u); - return ret; - } else { -string_key: + zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(utf8_conv)), &key.u, &u_len, arKey, nKeyLength-1, &status); + if (U_FAILURE(status)) { + ZEND_HASH_CVT_ERROR(); return zend_u_hash_exists(ht, IS_STRING, ZSTR(arKey), nKeyLength); - } + } + ret = zend_u_hash_exists(ht, IS_UNICODE, key, u_len+1); + efree(key.u); + return ret; } /* }}} */ diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c index fab64c871a..0c33e55595 100644 --- a/Zend/zend_ini.c +++ b/Zend/zend_ini.c @@ -667,7 +667,6 @@ ZEND_API ZEND_INI_MH(OnUpdateStringUnempty) /* {{{ */ ZEND_API ZEND_INI_MH(OnUpdateUTF8String) /* {{{ */ { UChar **up; - char **p; UChar *ustr = NULL; int32_t ustr_len, capacity; UErrorCode status = U_ZERO_ERROR; @@ -679,33 +678,29 @@ ZEND_API ZEND_INI_MH(OnUpdateUTF8String) /* {{{ */ base = (char *) ts_resource(*((int *) mh_arg2)); #endif /* Convert only if unicode semantics is on. Otherwise, same as OnUpdateString */ - if (UG(unicode)){ - /* estimate capacity */ - capacity = (new_value_length > 2) ? ((new_value_length >> 1) + (new_value_length >> 3) + 2) : new_value_length; - - while (1) { - ustr = peurealloc(ustr, capacity+1, 1); - u_strFromUTF8(ustr, capacity+1, &ustr_len, new_value, new_value_length, &status); - if (status == U_BUFFER_OVERFLOW_ERROR || status == U_STRING_NOT_TERMINATED_WARNING) { - capacity = ustr_len; - status = U_ZERO_ERROR; - } else { - break; - } - } - - if (U_FAILURE(status)) { - zend_error(E_WARNING, "Could not convert UTF-8 INI value to Unicode"); - efree(ustr); - return FAILURE; + /* estimate capacity */ + capacity = (new_value_length > 2) ? ((new_value_length >> 1) + (new_value_length >> 3) + 2) : new_value_length; + + while (1) { + ustr = peurealloc(ustr, capacity+1, 1); + u_strFromUTF8(ustr, capacity+1, &ustr_len, new_value, new_value_length, &status); + if (status == U_BUFFER_OVERFLOW_ERROR || status == U_STRING_NOT_TERMINATED_WARNING) { + capacity = ustr_len; + status = U_ZERO_ERROR; + } else { + break; } + } - up = (UChar **) (base+(size_t) mh_arg1); - *up = ustr; - } else { /* Same as OnUpdateString */ - p = (char **) (base+(size_t) mh_arg1); - *p = new_value; + if (U_FAILURE(status)) { + zend_error(E_WARNING, "Could not convert UTF-8 INI value to Unicode"); + efree(ustr); + return FAILURE; } + + up = (UChar **) (base+(size_t) mh_arg1); + *up = ustr; + return SUCCESS; } /* }}} */ diff --git a/Zend/zend_ini_parser.y b/Zend/zend_ini_parser.y index 831bf312db..e496ac77ed 100644 --- a/Zend/zend_ini_parser.y +++ b/Zend/zend_ini_parser.y @@ -116,43 +116,26 @@ static void zend_ini_add_string(zval *result, zval *op1, zval *op2) static void zend_ini_get_constant(zval *result, zval *name TSRMLS_DC) { zval z_constant; + UChar *u_name; /* in Unicode mode all constants are registered as Unicode */ - if (UG(unicode)) { - UChar *u_name; - - u_name = malloc(UBYTES(Z_STRLEN_P(name) + 1)); - u_charsToUChars(Z_STRVAL_P(name), u_name, Z_STRLEN_P(name) + 1); - - /* If name contains ':' it is not a constant. Bug #26893. */ - if (!u_memchr(u_name, ':', Z_STRLEN_P(name)) - && zend_u_get_constant_ex(IS_UNICODE, ZSTR(u_name), Z_STRLEN_P(name), &z_constant, NULL, 0 TSRMLS_CC)) { - /* z_constant is emalloc()'d */ - convert_to_string(&z_constant); - Z_STRVAL_P(result) = zend_strndup(Z_STRVAL(z_constant), Z_STRLEN(z_constant)); - Z_STRLEN_P(result) = Z_STRLEN(z_constant); - Z_TYPE_P(result) = Z_TYPE(z_constant); - zval_dtor(&z_constant); - free(Z_STRVAL_P(name)); - } else { - *result = *name; - } - free(u_name); + u_name = malloc(UBYTES(Z_STRLEN_P(name) + 1)); + u_charsToUChars(Z_STRVAL_P(name), u_name, Z_STRLEN_P(name) + 1); + + /* If name contains ':' it is not a constant. Bug #26893. */ + if (!u_memchr(u_name, ':', Z_STRLEN_P(name)) + && zend_u_get_constant_ex(IS_UNICODE, ZSTR(u_name), Z_STRLEN_P(name), &z_constant, NULL, 0 TSRMLS_CC)) { + /* z_constant is emalloc()'d */ + convert_to_string(&z_constant); + Z_STRVAL_P(result) = zend_strndup(Z_STRVAL(z_constant), Z_STRLEN(z_constant)); + Z_STRLEN_P(result) = Z_STRLEN(z_constant); + Z_TYPE_P(result) = Z_TYPE(z_constant); + zval_dtor(&z_constant); + free(Z_STRVAL_P(name)); } else { - /* If name contains ':' it is not a constant. Bug #26893. */ - if (!memchr(Z_STRVAL_P(name), ':', Z_STRLEN_P(name)) - && zend_get_constant(Z_STRVAL_P(name), Z_STRLEN_P(name), &z_constant TSRMLS_CC)) { - /* z_constant is emalloc()'d */ - convert_to_string(&z_constant); - Z_STRVAL_P(result) = zend_strndup(Z_STRVAL(z_constant), Z_STRLEN(z_constant)); - Z_STRLEN_P(result) = Z_STRLEN(z_constant); - Z_TYPE_P(result) = Z_TYPE(z_constant); - zval_dtor(&z_constant); - free(Z_STRVAL_P(name)); - } else { - *result = *name; - } + *result = *name; } + free(u_name); } /* }}} */ diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index 77864b5c33..3d39ace2ff 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -638,7 +638,7 @@ expr_without_variable: | internal_functions_in_yacc { $$ = $1; } | T_INT_CAST expr { zend_do_cast(&$$, &$2, IS_LONG TSRMLS_CC); } | T_DOUBLE_CAST expr { zend_do_cast(&$$, &$2, IS_DOUBLE TSRMLS_CC); } - | T_STRING_CAST expr { zend_do_cast(&$$, &$2, UG(unicode)?IS_UNICODE:IS_STRING TSRMLS_CC); } + | T_STRING_CAST expr { zend_do_cast(&$$, &$2, IS_UNICODE TSRMLS_CC); } | T_UNICODE_CAST expr { zend_do_cast(&$$, &$2, IS_UNICODE TSRMLS_CC); } | T_BINARY_CAST expr { zend_do_cast(&$$, &$2, IS_STRING TSRMLS_CC); } | T_ARRAY_CAST expr { zend_do_cast(&$$, &$2, IS_ARRAY TSRMLS_CC); } @@ -649,7 +649,7 @@ expr_without_variable: | '@' { zend_do_begin_silence(&$1 TSRMLS_CC); } expr { zend_do_end_silence(&$1 TSRMLS_CC); $$ = $3; } | scalar { $$ = $1; } | T_ARRAY '(' array_pair_list ')' { $$ = $3; } - | '`' { CG(literal_type) = UG(unicode)?IS_UNICODE:IS_STRING; } backticks_expr '`' { zend_do_shell_exec(&$$, &$3 TSRMLS_CC); } + | '`' { CG(literal_type) = IS_UNICODE; } backticks_expr '`' { zend_do_shell_exec(&$$, &$3 TSRMLS_CC); } | T_PRINT expr { zend_do_print(&$$, &$2 TSRMLS_CC); } | function is_reference '(' { zend_do_begin_lambda_function_declaration(&$$, &$1, $2.op_type, 0 TSRMLS_CC); } parameter_list ')' lexical_vars '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); $$ = $4; } @@ -773,7 +773,7 @@ common_scalar: ; start_heredoc: - T_START_HEREDOC { CG(literal_type) = UG(unicode)?IS_UNICODE:IS_STRING; $$ = $1; } + T_START_HEREDOC { CG(literal_type) = IS_UNICODE; $$ = $1; } | T_BINARY_HEREDOC { CG(literal_type) = IS_STRING; $$ = $1; } ; @@ -800,7 +800,7 @@ scalar: | T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_TEXT(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); $3 = $$; zend_do_fetch_constant(&$$, NULL, &$3, ZEND_RT, 0 TSRMLS_CC); } | T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_TEXT(&$$.u.constant); zend_do_build_full_name(NULL, &$$, &$2, 0 TSRMLS_CC); $2 = $$; zend_do_fetch_constant(&$$, NULL, &$2, ZEND_RT, 0 TSRMLS_CC); } | common_scalar { $$ = $1; } - | '"' { CG(literal_type) = UG(unicode)?IS_UNICODE:IS_STRING; } encaps_list '"' { $$ = $3; } + | '"' { CG(literal_type) = IS_UNICODE; } encaps_list '"' { $$ = $3; } | T_BINARY_DOUBLE { CG(literal_type) = IS_STRING; } encaps_list '"' { $$ = $3; } | start_heredoc encaps_list T_END_HEREDOC { $$ = $2; CG(heredoc) = Z_STRVAL($1.u.constant); CG(heredoc_len) = Z_STRLEN($1.u.constant); } ; diff --git a/Zend/zend_language_scanner.c b/Zend/zend_language_scanner.c index ee0d7386d2..e5ed1e68b7 100644 --- a/Zend/zend_language_scanner.c +++ b/Zend/zend_language_scanner.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Thu Mar 26 15:38:15 2009 */ +/* Generated by re2c 0.13.5 on Thu Mar 26 16:22:31 2009 */ #line 1 "Zend/zend_language_scanner.l" /* +----------------------------------------------------------------------+ @@ -608,12 +608,6 @@ int zend_unicode_yyinput(zend_file_handle *file_handle, char *buf, size_t len TS n = zend_stream_read(file_handle, buf, len TSRMLS_CC); } #endif - - /* Don't make any conversions if unicode=off */ - if (!UG(unicode)) { - return n; - } - /* Autodetect encoding */ if (!SCNG(encoding_checked)) { int32_t signatureLength; @@ -869,7 +863,7 @@ zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC) tmp = *source_string; zval_copy_ctor(&tmp); if (Z_TYPE(tmp) != IS_STRING && Z_TYPE(tmp) != IS_UNICODE) { - convert_to_text(&tmp); + convert_to_unicode(&tmp); } source_string = &tmp; @@ -1323,7 +1317,7 @@ restart: yymore_restart: -#line 1327 "Zend/zend_language_scanner.c" +#line 1321 "Zend/zend_language_scanner.c" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -1425,9 +1419,9 @@ yy2: ++YYCURSOR; YYDEBUG(3, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2654 "Zend/zend_language_scanner.l" +#line 2620 "Zend/zend_language_scanner.l" { return 0; } -#line 1431 "Zend/zend_language_scanner.c" +#line 1425 "Zend/zend_language_scanner.c" yy4: YYDEBUG(4, *YYCURSOR); yyaccept = 0; @@ -1445,7 +1439,7 @@ yy4: yy5: YYDEBUG(5, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2133 "Zend/zend_language_scanner.l" +#line 2109 "Zend/zend_language_scanner.l" { inline_char_handler: @@ -1476,7 +1470,7 @@ inline_char_handler: HANDLE_NEWLINES(yytext, yyleng); return T_INLINE_HTML; } -#line 1480 "Zend/zend_language_scanner.c" +#line 1474 "Zend/zend_language_scanner.c" yy6: YYDEBUG(6, *YYCURSOR); yych = *++YYCURSOR; @@ -1494,7 +1488,7 @@ yy7: yy8: YYDEBUG(8, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2121 "Zend/zend_language_scanner.l" +#line 2097 "Zend/zend_language_scanner.l" { if (CG(short_tags)) { Z_STRVAL_P(zendlval) = yytext; /* no copying - intentional */ @@ -1506,14 +1500,14 @@ yy8: goto inline_char_handler; } } -#line 1510 "Zend/zend_language_scanner.c" +#line 1504 "Zend/zend_language_scanner.c" yy9: YYDEBUG(9, *YYCURSOR); ++YYCURSOR; if ((yych = *YYCURSOR) == '=') goto yy45; YYDEBUG(10, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2098 "Zend/zend_language_scanner.l" +#line 2074 "Zend/zend_language_scanner.l" { if (CG(asp_tags)) { Z_STRVAL_P(zendlval) = yytext; /* no copying - intentional */ @@ -1525,7 +1519,7 @@ yy9: goto inline_char_handler; } } -#line 1529 "Zend/zend_language_scanner.c" +#line 1523 "Zend/zend_language_scanner.c" yy11: YYDEBUG(11, *YYCURSOR); yych = *++YYCURSOR; @@ -1711,7 +1705,7 @@ yy37: ++YYCURSOR; YYDEBUG(40, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2063 "Zend/zend_language_scanner.l" +#line 2039 "Zend/zend_language_scanner.l" { HANDLE_NEWLINES(yytext, yyleng); Z_STRVAL_P(zendlval) = yytext; /* no copying - intentional */ @@ -1720,7 +1714,7 @@ yy37: BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG; } -#line 1724 "Zend/zend_language_scanner.c" +#line 1718 "Zend/zend_language_scanner.c" yy41: YYDEBUG(41, *YYCURSOR); yych = *++YYCURSOR; @@ -1747,7 +1741,7 @@ yy45: ++YYCURSOR; YYDEBUG(46, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2072 "Zend/zend_language_scanner.l" +#line 2048 "Zend/zend_language_scanner.l" { if (CG(asp_tags)) { Z_STRVAL_P(zendlval) = yytext; /* no copying - intentional */ @@ -1759,13 +1753,13 @@ yy45: goto inline_char_handler; } } -#line 1763 "Zend/zend_language_scanner.c" +#line 1757 "Zend/zend_language_scanner.c" yy47: YYDEBUG(47, *YYCURSOR); ++YYCURSOR; YYDEBUG(48, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2085 "Zend/zend_language_scanner.l" +#line 2061 "Zend/zend_language_scanner.l" { if (CG(short_tags)) { Z_STRVAL_P(zendlval) = yytext; /* no copying - intentional */ @@ -1777,7 +1771,7 @@ yy47: goto inline_char_handler; } } -#line 1781 "Zend/zend_language_scanner.c" +#line 1775 "Zend/zend_language_scanner.c" yy49: YYDEBUG(49, *YYCURSOR); yych = *++YYCURSOR; @@ -1804,7 +1798,7 @@ yy52: yy53: YYDEBUG(53, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2111 "Zend/zend_language_scanner.l" +#line 2087 "Zend/zend_language_scanner.l" { Z_STRVAL_P(zendlval) = yytext; /* no copying - intentional */ Z_STRLEN_P(zendlval) = yyleng; @@ -1813,7 +1807,7 @@ yy53: BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG; } -#line 1817 "Zend/zend_language_scanner.c" +#line 1811 "Zend/zend_language_scanner.c" yy54: YYDEBUG(54, *YYCURSOR); ++YYCURSOR; @@ -1884,7 +1878,7 @@ yyc_ST_BACKQUOTE: yy58: YYDEBUG(58, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2552 "Zend/zend_language_scanner.l" +#line 2518 "Zend/zend_language_scanner.l" { if (CG(literal_type) == IS_UNICODE) { return zend_scan_unicode_escape_string(zendlval, yytext, yyleng, 0x60 /*'`'*/, T_ENCAPSED_AND_WHITESPACE TSRMLS_CC); @@ -1893,7 +1887,7 @@ yy58: return T_ENCAPSED_AND_WHITESPACE; } } -#line 1897 "Zend/zend_language_scanner.c" +#line 1891 "Zend/zend_language_scanner.c" yy59: YYDEBUG(59, *YYCURSOR); yych = *++YYCURSOR; @@ -1931,13 +1925,13 @@ yy60: yy61: YYDEBUG(61, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2518 "Zend/zend_language_scanner.l" +#line 2484 "Zend/zend_language_scanner.l" { Z_LVAL_P(zendlval) = (long) '{'; yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); return T_CURLY_OPEN; } -#line 1941 "Zend/zend_language_scanner.c" +#line 1935 "Zend/zend_language_scanner.c" yy62: YYDEBUG(62, *YYCURSOR); yyaccept = 0; @@ -1980,12 +1974,12 @@ yy66: ++YYCURSOR; YYDEBUG(67, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2649 "Zend/zend_language_scanner.l" +#line 2615 "Zend/zend_language_scanner.l" { BEGIN(ST_IN_SCRIPTING); return '`'; } -#line 1989 "Zend/zend_language_scanner.c" +#line 1983 "Zend/zend_language_scanner.c" yy68: YYDEBUG(68, *YYCURSOR); ++YYCURSOR; @@ -2058,7 +2052,7 @@ yy71: yy73: YYDEBUG(73, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2561 "Zend/zend_language_scanner.l" +#line 2527 "Zend/zend_language_scanner.l" { yyless(yyleng - 1); @@ -2069,7 +2063,7 @@ yy73: return T_ENCAPSED_AND_WHITESPACE; } } -#line 2073 "Zend/zend_language_scanner.c" +#line 2067 "Zend/zend_language_scanner.c" yy74: YYDEBUG(74, *YYCURSOR); yych = *++YYCURSOR; @@ -2103,28 +2097,28 @@ yy77: yy79: YYDEBUG(79, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2195 "Zend/zend_language_scanner.l" +#line 2171 "Zend/zend_language_scanner.l" { - if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), UG(unicode)?IS_UNICODE:IS_STRING, SCNG(output_conv) TSRMLS_CC)) { + if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), IS_UNICODE, SCNG(output_conv) TSRMLS_CC)) { return 0; } - if (UG(unicode) && !zend_check_and_normalize_identifier(zendlval)) { + if (!zend_check_and_normalize_identifier(zendlval)) { return 0; } return T_VARIABLE; } -#line 2117 "Zend/zend_language_scanner.c" +#line 2111 "Zend/zend_language_scanner.c" yy80: YYDEBUG(80, *YYCURSOR); ++YYCURSOR; YYDEBUG(81, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1828 "Zend/zend_language_scanner.l" +#line 1822 "Zend/zend_language_scanner.l" { yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC); return T_DOLLAR_OPEN_CURLY_BRACES; } -#line 2128 "Zend/zend_language_scanner.c" +#line 2122 "Zend/zend_language_scanner.c" yy82: YYDEBUG(82, *YYCURSOR); yych = *++YYCURSOR; @@ -2135,20 +2129,20 @@ yy83: ++YYCURSOR; YYDEBUG(84, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2182 "Zend/zend_language_scanner.l" +#line 2158 "Zend/zend_language_scanner.l" { yyless(yyleng - 1); yy_push_state(ST_VAR_OFFSET TSRMLS_CC); - if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), UG(unicode)?IS_UNICODE:IS_STRING, SCNG(output_conv) TSRMLS_CC)) { + if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), IS_UNICODE, SCNG(output_conv) TSRMLS_CC)) { return 0; } - if (UG(unicode) && !zend_check_and_normalize_identifier(zendlval)) { + if (!zend_check_and_normalize_identifier(zendlval)) { return 0; } return T_VARIABLE; } -#line 2152 "Zend/zend_language_scanner.c" +#line 2146 "Zend/zend_language_scanner.c" yy85: YYDEBUG(85, *YYCURSOR); yych = *++YYCURSOR; @@ -2166,20 +2160,20 @@ yy86: ++YYCURSOR; YYDEBUG(87, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2167 "Zend/zend_language_scanner.l" +#line 2143 "Zend/zend_language_scanner.l" { yyless(yyleng - 3); yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); - if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), UG(unicode)?IS_UNICODE:IS_STRING, SCNG(output_conv) TSRMLS_CC)) { + if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), IS_UNICODE, SCNG(output_conv) TSRMLS_CC)) { return 0; } - if (UG(unicode) && !zend_check_and_normalize_identifier(zendlval)) { + if (!zend_check_and_normalize_identifier(zendlval)) { return 0; } return T_VARIABLE; } -#line 2183 "Zend/zend_language_scanner.c" +#line 2177 "Zend/zend_language_scanner.c" } /* *********************************** */ yyc_ST_COMMENT: @@ -2232,12 +2226,12 @@ yy90: } YYDEBUG(91, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2296 "Zend/zend_language_scanner.l" +#line 2272 "Zend/zend_language_scanner.l" { zend_error(E_COMPILE_WARNING, "Unterminated comment starting line %d", CG(zend_lineno)); return 0; } -#line 2241 "Zend/zend_language_scanner.c" +#line 2235 "Zend/zend_language_scanner.c" yy92: YYDEBUG(92, *YYCURSOR); ++YYCURSOR; @@ -2249,34 +2243,34 @@ yy92: } YYDEBUG(94, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2307 "Zend/zend_language_scanner.l" +#line 2283 "Zend/zend_language_scanner.l" { yymore(); } -#line 2257 "Zend/zend_language_scanner.c" +#line 2251 "Zend/zend_language_scanner.c" yy95: YYDEBUG(95, *YYCURSOR); ++YYCURSOR; if ((yych = *YYCURSOR) == '/') goto yy97; YYDEBUG(96, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2330 "Zend/zend_language_scanner.l" +#line 2306 "Zend/zend_language_scanner.l" { yymore(); } -#line 2268 "Zend/zend_language_scanner.c" +#line 2262 "Zend/zend_language_scanner.c" yy97: YYDEBUG(97, *YYCURSOR); ++YYCURSOR; YYDEBUG(98, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2324 "Zend/zend_language_scanner.l" +#line 2300 "Zend/zend_language_scanner.l" { HANDLE_NEWLINES(yytext, yyleng); BEGIN(ST_IN_SCRIPTING); return T_COMMENT; } -#line 2280 "Zend/zend_language_scanner.c" +#line 2274 "Zend/zend_language_scanner.c" } /* *********************************** */ yyc_ST_DOC_COMMENT: @@ -2329,12 +2323,12 @@ yy101: } YYDEBUG(102, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2296 "Zend/zend_language_scanner.l" +#line 2272 "Zend/zend_language_scanner.l" { zend_error(E_COMPILE_WARNING, "Unterminated comment starting line %d", CG(zend_lineno)); return 0; } -#line 2338 "Zend/zend_language_scanner.c" +#line 2332 "Zend/zend_language_scanner.c" yy103: YYDEBUG(103, *YYCURSOR); ++YYCURSOR; @@ -2346,33 +2340,33 @@ yy103: } YYDEBUG(105, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2307 "Zend/zend_language_scanner.l" +#line 2283 "Zend/zend_language_scanner.l" { yymore(); } -#line 2354 "Zend/zend_language_scanner.c" +#line 2348 "Zend/zend_language_scanner.c" yy106: YYDEBUG(106, *YYCURSOR); ++YYCURSOR; if ((yych = *YYCURSOR) == '/') goto yy108; YYDEBUG(107, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2330 "Zend/zend_language_scanner.l" +#line 2306 "Zend/zend_language_scanner.l" { yymore(); } -#line 2365 "Zend/zend_language_scanner.c" +#line 2359 "Zend/zend_language_scanner.c" yy108: YYDEBUG(108, *YYCURSOR); ++YYCURSOR; YYDEBUG(109, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2311 "Zend/zend_language_scanner.l" +#line 2287 "Zend/zend_language_scanner.l" { zval temp; HANDLE_NEWLINES(yytext, yyleng); - if (!zend_copy_scanner_string(&temp, yytext, yyleng, UG(unicode)?IS_UNICODE:IS_STRING, SCNG(output_conv) TSRMLS_CC)) { + if (!zend_copy_scanner_string(&temp, yytext, yyleng, IS_UNICODE, SCNG(output_conv) TSRMLS_CC)) { return 0; } CG(doc_comment) = temp.value.uni.val; @@ -2380,7 +2374,7 @@ yy108: BEGIN(ST_IN_SCRIPTING); return T_DOC_COMMENT; } -#line 2384 "Zend/zend_language_scanner.c" +#line 2378 "Zend/zend_language_scanner.c" } /* *********************************** */ yyc_ST_DOUBLE_QUOTES: @@ -2446,7 +2440,7 @@ yyc_ST_DOUBLE_QUOTES: yy113: YYDEBUG(113, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2525 "Zend/zend_language_scanner.l" +#line 2491 "Zend/zend_language_scanner.l" { if (CG(literal_type) == IS_UNICODE) { return zend_scan_unicode_escape_string(zendlval, yytext, yyleng, 0x22 /*'"'*/, T_ENCAPSED_AND_WHITESPACE TSRMLS_CC); @@ -2455,7 +2449,7 @@ yy113: return T_ENCAPSED_AND_WHITESPACE; } } -#line 2459 "Zend/zend_language_scanner.c" +#line 2453 "Zend/zend_language_scanner.c" yy114: YYDEBUG(114, *YYCURSOR); yych = *++YYCURSOR; @@ -2494,13 +2488,13 @@ yy115: yy116: YYDEBUG(116, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2518 "Zend/zend_language_scanner.l" +#line 2484 "Zend/zend_language_scanner.l" { Z_LVAL_P(zendlval) = (long) '{'; yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); return T_CURLY_OPEN; } -#line 2504 "Zend/zend_language_scanner.c" +#line 2498 "Zend/zend_language_scanner.c" yy117: YYDEBUG(117, *YYCURSOR); yyaccept = 0; @@ -2542,12 +2536,12 @@ yy121: ++YYCURSOR; YYDEBUG(122, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2643 "Zend/zend_language_scanner.l" +#line 2609 "Zend/zend_language_scanner.l" { BEGIN(ST_IN_SCRIPTING); return '"'; } -#line 2551 "Zend/zend_language_scanner.c" +#line 2545 "Zend/zend_language_scanner.c" yy123: YYDEBUG(123, *YYCURSOR); ++YYCURSOR; @@ -2623,7 +2617,7 @@ yy126: yy128: YYDEBUG(128, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2540 "Zend/zend_language_scanner.l" +#line 2506 "Zend/zend_language_scanner.l" { yyless(yyleng - 1); @@ -2634,7 +2628,7 @@ yy128: return T_ENCAPSED_AND_WHITESPACE; } } -#line 2638 "Zend/zend_language_scanner.c" +#line 2632 "Zend/zend_language_scanner.c" yy129: YYDEBUG(129, *YYCURSOR); yych = *++YYCURSOR; @@ -2668,28 +2662,28 @@ yy132: yy134: YYDEBUG(134, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2195 "Zend/zend_language_scanner.l" +#line 2171 "Zend/zend_language_scanner.l" { - if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), UG(unicode)?IS_UNICODE:IS_STRING, SCNG(output_conv) TSRMLS_CC)) { + if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), IS_UNICODE, SCNG(output_conv) TSRMLS_CC)) { return 0; } - if (UG(unicode) && !zend_check_and_normalize_identifier(zendlval)) { + if (!zend_check_and_normalize_identifier(zendlval)) { return 0; } return T_VARIABLE; } -#line 2682 "Zend/zend_language_scanner.c" +#line 2676 "Zend/zend_language_scanner.c" yy135: YYDEBUG(135, *YYCURSOR); ++YYCURSOR; YYDEBUG(136, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1828 "Zend/zend_language_scanner.l" +#line 1822 "Zend/zend_language_scanner.l" { yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC); return T_DOLLAR_OPEN_CURLY_BRACES; } -#line 2693 "Zend/zend_language_scanner.c" +#line 2687 "Zend/zend_language_scanner.c" yy137: YYDEBUG(137, *YYCURSOR); yych = *++YYCURSOR; @@ -2700,20 +2694,20 @@ yy138: ++YYCURSOR; YYDEBUG(139, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2182 "Zend/zend_language_scanner.l" +#line 2158 "Zend/zend_language_scanner.l" { yyless(yyleng - 1); yy_push_state(ST_VAR_OFFSET TSRMLS_CC); - if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), UG(unicode)?IS_UNICODE:IS_STRING, SCNG(output_conv) TSRMLS_CC)) { + if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), IS_UNICODE, SCNG(output_conv) TSRMLS_CC)) { return 0; } - if (UG(unicode) && !zend_check_and_normalize_identifier(zendlval)) { + if (!zend_check_and_normalize_identifier(zendlval)) { return 0; } return T_VARIABLE; } -#line 2717 "Zend/zend_language_scanner.c" +#line 2711 "Zend/zend_language_scanner.c" yy140: YYDEBUG(140, *YYCURSOR); yych = *++YYCURSOR; @@ -2731,20 +2725,20 @@ yy141: ++YYCURSOR; YYDEBUG(142, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2167 "Zend/zend_language_scanner.l" +#line 2143 "Zend/zend_language_scanner.l" { yyless(yyleng - 3); yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); - if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), UG(unicode)?IS_UNICODE:IS_STRING, SCNG(output_conv) TSRMLS_CC)) { + if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), IS_UNICODE, SCNG(output_conv) TSRMLS_CC)) { return 0; } - if (UG(unicode) && !zend_check_and_normalize_identifier(zendlval)) { + if (!zend_check_and_normalize_identifier(zendlval)) { return 0; } return T_VARIABLE; } -#line 2748 "Zend/zend_language_scanner.c" +#line 2742 "Zend/zend_language_scanner.c" } /* *********************************** */ yyc_ST_END_HEREDOC: @@ -2756,15 +2750,15 @@ yyc_ST_END_HEREDOC: ++YYCURSOR; YYDEBUG(146, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2654 "Zend/zend_language_scanner.l" +#line 2620 "Zend/zend_language_scanner.l" { return 0; } -#line 2762 "Zend/zend_language_scanner.c" +#line 2756 "Zend/zend_language_scanner.c" yy147: YYDEBUG(147, *YYCURSOR); ++YYCURSOR; YYDEBUG(148, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2504 "Zend/zend_language_scanner.l" +#line 2470 "Zend/zend_language_scanner.l" { YYCURSOR += CG(heredoc_len) - 1; yyleng = CG(heredoc_len); @@ -2776,7 +2770,7 @@ yy147: BEGIN(ST_IN_SCRIPTING); return T_END_HEREDOC; } -#line 2780 "Zend/zend_language_scanner.c" +#line 2774 "Zend/zend_language_scanner.c" /* *********************************** */ yyc_ST_HEREDOC: { @@ -2846,7 +2840,7 @@ yyc_ST_HEREDOC: yy151: YYDEBUG(151, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2580 "Zend/zend_language_scanner.l" +#line 2546 "Zend/zend_language_scanner.l" { if (CG(literal_type) == IS_UNICODE) { return zend_scan_unicode_escape_string(zendlval, yytext, yyleng, 0, T_ENCAPSED_AND_WHITESPACE TSRMLS_CC); @@ -2855,7 +2849,7 @@ yy151: return T_ENCAPSED_AND_WHITESPACE; } } -#line 2859 "Zend/zend_language_scanner.c" +#line 2853 "Zend/zend_language_scanner.c" yy152: YYDEBUG(152, *YYCURSOR); yyaccept = 0; @@ -2906,13 +2900,13 @@ yy154: yy155: YYDEBUG(155, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2518 "Zend/zend_language_scanner.l" +#line 2484 "Zend/zend_language_scanner.l" { Z_LVAL_P(zendlval) = (long) '{'; yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); return T_CURLY_OPEN; } -#line 2916 "Zend/zend_language_scanner.c" +#line 2910 "Zend/zend_language_scanner.c" yy156: YYDEBUG(156, *YYCURSOR); yyaccept = 0; @@ -3163,7 +3157,7 @@ yy172: yy174: YYDEBUG(174, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2589 "Zend/zend_language_scanner.l" +#line 2555 "Zend/zend_language_scanner.l" { yyless(yyleng - 1); @@ -3174,7 +3168,7 @@ yy174: return T_ENCAPSED_AND_WHITESPACE; } } -#line 3178 "Zend/zend_language_scanner.c" +#line 3172 "Zend/zend_language_scanner.c" yy175: YYDEBUG(175, *YYCURSOR); yyaccept = 2; @@ -3273,7 +3267,7 @@ yy181: ++YYCURSOR; YYDEBUG(182, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2462 "Zend/zend_language_scanner.l" +#line 2428 "Zend/zend_language_scanner.l" { char *end = yytext + yyleng - 1; @@ -3315,7 +3309,7 @@ yy181: yymore(); } } -#line 3319 "Zend/zend_language_scanner.c" +#line 3313 "Zend/zend_language_scanner.c" yy183: YYDEBUG(183, *YYCURSOR); yyaccept = 2; @@ -3575,28 +3569,28 @@ yy202: yy204: YYDEBUG(204, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2195 "Zend/zend_language_scanner.l" +#line 2171 "Zend/zend_language_scanner.l" { - if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), UG(unicode)?IS_UNICODE:IS_STRING, SCNG(output_conv) TSRMLS_CC)) { + if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), IS_UNICODE, SCNG(output_conv) TSRMLS_CC)) { return 0; } - if (UG(unicode) && !zend_check_and_normalize_identifier(zendlval)) { + if (!zend_check_and_normalize_identifier(zendlval)) { return 0; } return T_VARIABLE; } -#line 3589 "Zend/zend_language_scanner.c" +#line 3583 "Zend/zend_language_scanner.c" yy205: YYDEBUG(205, *YYCURSOR); ++YYCURSOR; YYDEBUG(206, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1828 "Zend/zend_language_scanner.l" +#line 1822 "Zend/zend_language_scanner.l" { yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC); return T_DOLLAR_OPEN_CURLY_BRACES; } -#line 3600 "Zend/zend_language_scanner.c" +#line 3594 "Zend/zend_language_scanner.c" yy207: YYDEBUG(207, *YYCURSOR); yych = *++YYCURSOR; @@ -3607,20 +3601,20 @@ yy208: ++YYCURSOR; YYDEBUG(209, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2182 "Zend/zend_language_scanner.l" +#line 2158 "Zend/zend_language_scanner.l" { yyless(yyleng - 1); yy_push_state(ST_VAR_OFFSET TSRMLS_CC); - if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), UG(unicode)?IS_UNICODE:IS_STRING, SCNG(output_conv) TSRMLS_CC)) { + if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), IS_UNICODE, SCNG(output_conv) TSRMLS_CC)) { return 0; } - if (UG(unicode) && !zend_check_and_normalize_identifier(zendlval)) { + if (!zend_check_and_normalize_identifier(zendlval)) { return 0; } return T_VARIABLE; } -#line 3624 "Zend/zend_language_scanner.c" +#line 3618 "Zend/zend_language_scanner.c" yy210: YYDEBUG(210, *YYCURSOR); yych = *++YYCURSOR; @@ -3638,20 +3632,20 @@ yy211: ++YYCURSOR; YYDEBUG(212, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2167 "Zend/zend_language_scanner.l" +#line 2143 "Zend/zend_language_scanner.l" { yyless(yyleng - 3); yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); - if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), UG(unicode)?IS_UNICODE:IS_STRING, SCNG(output_conv) TSRMLS_CC)) { + if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), IS_UNICODE, SCNG(output_conv) TSRMLS_CC)) { return 0; } - if (UG(unicode) && !zend_check_and_normalize_identifier(zendlval)) { + if (!zend_check_and_normalize_identifier(zendlval)) { return 0; } return T_VARIABLE; } -#line 3655 "Zend/zend_language_scanner.c" +#line 3649 "Zend/zend_language_scanner.c" } /* *********************************** */ yyc_ST_IN_SCRIPTING: @@ -3849,9 +3843,9 @@ yy215: ++YYCURSOR; YYDEBUG(216, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2654 "Zend/zend_language_scanner.l" +#line 2620 "Zend/zend_language_scanner.l" { return 0; } -#line 3855 "Zend/zend_language_scanner.c" +#line 3849 "Zend/zend_language_scanner.c" yy217: YYDEBUG(217, *YYCURSOR); ++YYCURSOR; @@ -3874,17 +3868,17 @@ yy217: yy218: YYDEBUG(218, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2223 "Zend/zend_language_scanner.l" +#line 2199 "Zend/zend_language_scanner.l" { - if (!zend_copy_scanner_string(zendlval, yytext, yyleng, UG(unicode)?IS_UNICODE:IS_STRING, SCNG(output_conv) TSRMLS_CC)) { + if (!zend_copy_scanner_string(zendlval, yytext, yyleng, IS_UNICODE, SCNG(output_conv) TSRMLS_CC)) { return 0; } - if (UG(unicode) && !zend_check_and_normalize_identifier(zendlval)) { + if (!zend_check_and_normalize_identifier(zendlval)) { return 0; } return T_STRING; } -#line 3888 "Zend/zend_language_scanner.c" +#line 3882 "Zend/zend_language_scanner.c" yy219: YYDEBUG(219, *YYCURSOR); yych = *++YYCURSOR; @@ -4131,11 +4125,11 @@ yy231: yy232: YYDEBUG(232, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1817 "Zend/zend_language_scanner.l" +#line 1811 "Zend/zend_language_scanner.l" { return yytext[0]; } -#line 4139 "Zend/zend_language_scanner.c" +#line 4133 "Zend/zend_language_scanner.c" yy233: YYDEBUG(233, *YYCURSOR); ++YYCURSOR; @@ -4144,7 +4138,7 @@ yy233: yy234: YYDEBUG(234, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1544 "Zend/zend_language_scanner.l" +#line 1538 "Zend/zend_language_scanner.l" { Z_STRVAL_P(zendlval) = yytext; /* no copying - intentional */ Z_STRLEN_P(zendlval) = yyleng; @@ -4152,7 +4146,7 @@ yy234: HANDLE_NEWLINES(yytext, yyleng); return T_WHITESPACE; } -#line 4156 "Zend/zend_language_scanner.c" +#line 4150 "Zend/zend_language_scanner.c" yy235: YYDEBUG(235, *YYCURSOR); yych = *++YYCURSOR; @@ -4163,11 +4157,11 @@ yy236: ++YYCURSOR; YYDEBUG(237, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1577 "Zend/zend_language_scanner.l" +#line 1571 "Zend/zend_language_scanner.l" { return T_NS_SEPARATOR; } -#line 4171 "Zend/zend_language_scanner.c" +#line 4165 "Zend/zend_language_scanner.c" yy238: YYDEBUG(238, *YYCURSOR); yych = *++YYCURSOR; @@ -4395,18 +4389,18 @@ yy261: ++YYCURSOR; YYDEBUG(262, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1822 "Zend/zend_language_scanner.l" +#line 1816 "Zend/zend_language_scanner.l" { yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); return '{'; } -#line 4404 "Zend/zend_language_scanner.c" +#line 4398 "Zend/zend_language_scanner.c" yy263: YYDEBUG(263, *YYCURSOR); ++YYCURSOR; YYDEBUG(264, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1834 "Zend/zend_language_scanner.l" +#line 1828 "Zend/zend_language_scanner.l" { RESET_DOC_COMMENT(); if (!zend_stack_is_empty(&SCNG(state_stack))) { @@ -4414,7 +4408,7 @@ yy263: } return '}'; } -#line 4418 "Zend/zend_language_scanner.c" +#line 4412 "Zend/zend_language_scanner.c" yy265: YYDEBUG(265, *YYCURSOR); yyaccept = 2; @@ -4437,7 +4431,7 @@ yy265: yy266: YYDEBUG(266, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1864 "Zend/zend_language_scanner.l" +#line 1858 "Zend/zend_language_scanner.l" { if (yyleng < MAX_LENGTH_OF_LONG - 1) { /* Won't overflow */ Z_LVAL_P(zendlval) = strtol(yytext, NULL, 0); @@ -4458,7 +4452,7 @@ yy266: Z_TYPE_P(zendlval) = IS_LONG; return T_LNUMBER; } -#line 4462 "Zend/zend_language_scanner.c" +#line 4456 "Zend/zend_language_scanner.c" yy267: YYDEBUG(267, *YYCURSOR); yyaccept = 2; @@ -4486,12 +4480,12 @@ yy269: yy270: YYDEBUG(270, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2241 "Zend/zend_language_scanner.l" +#line 2217 "Zend/zend_language_scanner.l" { BEGIN(ST_ONE_LINE_COMMENT); yymore(); } -#line 4495 "Zend/zend_language_scanner.c" +#line 4489 "Zend/zend_language_scanner.c" yy271: YYDEBUG(271, *YYCURSOR); yyaccept = 3; @@ -4500,12 +4494,12 @@ yy271: yy272: YYDEBUG(272, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2391 "Zend/zend_language_scanner.l" +#line 2357 "Zend/zend_language_scanner.l" { BEGIN(ST_DOUBLE_QUOTES); return '"'; } -#line 4509 "Zend/zend_language_scanner.c" +#line 4503 "Zend/zend_language_scanner.c" yy273: YYDEBUG(273, *YYCURSOR); yyaccept = 4; @@ -4514,23 +4508,23 @@ yy273: yy274: YYDEBUG(274, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2656 "Zend/zend_language_scanner.l" +#line 2622 "Zend/zend_language_scanner.l" { zend_error(E_COMPILE_WARNING,"Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE); goto restart; } -#line 4523 "Zend/zend_language_scanner.c" +#line 4517 "Zend/zend_language_scanner.c" yy275: YYDEBUG(275, *YYCURSOR); ++YYCURSOR; YYDEBUG(276, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2450 "Zend/zend_language_scanner.l" +#line 2416 "Zend/zend_language_scanner.l" { BEGIN(ST_BACKQUOTE); return '`'; } -#line 4534 "Zend/zend_language_scanner.c" +#line 4528 "Zend/zend_language_scanner.c" yy277: YYDEBUG(277, *YYCURSOR); yych = *++YYCURSOR; @@ -4592,16 +4586,11 @@ yy282: ++YYCURSOR; YYDEBUG(283, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2375 "Zend/zend_language_scanner.l" +#line 2346 "Zend/zend_language_scanner.l" { - if (UG(unicode)) { - return zend_scan_unicode_single_string(zendlval TSRMLS_CC); - } else { - zend_scan_binary_single_string(zendlval, yytext+1, yyleng-2 TSRMLS_CC); - return T_CONSTANT_ENCAPSED_STRING; - } + return zend_scan_unicode_single_string(zendlval TSRMLS_CC); } -#line 4605 "Zend/zend_language_scanner.c" +#line 4594 "Zend/zend_language_scanner.c" yy284: YYDEBUG(284, *YYCURSOR); ++YYCURSOR; @@ -4667,16 +4656,11 @@ yy291: ++YYCURSOR; YYDEBUG(292, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2359 "Zend/zend_language_scanner.l" +#line 2335 "Zend/zend_language_scanner.l" { - if (UG(unicode)) { - return zend_scan_unicode_escape_string(zendlval, yytext+1, yyleng-2, 0x22 /*'"'*/, T_CONSTANT_ENCAPSED_STRING TSRMLS_CC); - } else { - zend_scan_binary_escape_string(zendlval, yytext+1, yyleng-2, '"' TSRMLS_CC); - return T_CONSTANT_ENCAPSED_STRING; - } + return zend_scan_unicode_escape_string(zendlval, yytext+1, yyleng-2, 0x22 /*'"'*/, T_CONSTANT_ENCAPSED_STRING TSRMLS_CC); } -#line 4680 "Zend/zend_language_scanner.c" +#line 4664 "Zend/zend_language_scanner.c" yy293: YYDEBUG(293, *YYCURSOR); ++YYCURSOR; @@ -4710,13 +4694,13 @@ yy296: yy298: YYDEBUG(298, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1925 "Zend/zend_language_scanner.l" +#line 1919 "Zend/zend_language_scanner.l" { Z_DVAL_P(zendlval) = zend_strtod(yytext, NULL); Z_TYPE_P(zendlval) = IS_DOUBLE; return T_DNUMBER; } -#line 4720 "Zend/zend_language_scanner.c" +#line 4704 "Zend/zend_language_scanner.c" yy299: YYDEBUG(299, *YYCURSOR); yyaccept = 2; @@ -4778,7 +4762,7 @@ yy306: } YYDEBUG(308, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1885 "Zend/zend_language_scanner.l" +#line 1879 "Zend/zend_language_scanner.l" { char *hex = yytext + 2; /* Skip "0x" */ int len = yyleng - 2; @@ -4799,7 +4783,7 @@ yy306: return T_DNUMBER; } } -#line 4803 "Zend/zend_language_scanner.c" +#line 4787 "Zend/zend_language_scanner.c" yy309: YYDEBUG(309, *YYCURSOR); ++YYCURSOR; @@ -4808,7 +4792,7 @@ yy309: yy310: YYDEBUG(310, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2334 "Zend/zend_language_scanner.l" +#line 2310 "Zend/zend_language_scanner.l" { Z_STRVAL_P(zendlval) = yytext; /* no copying - intentional */ Z_STRLEN_P(zendlval) = yyleng; @@ -4816,7 +4800,7 @@ yy310: BEGIN(INITIAL); return T_CLOSE_TAG; /* implicit ';' at php-end tag */ } -#line 4820 "Zend/zend_language_scanner.c" +#line 4804 "Zend/zend_language_scanner.c" yy311: YYDEBUG(311, *YYCURSOR); yych = *++YYCURSOR; @@ -4850,17 +4834,17 @@ yy313: yy315: YYDEBUG(315, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2195 "Zend/zend_language_scanner.l" +#line 2171 "Zend/zend_language_scanner.l" { - if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), UG(unicode)?IS_UNICODE:IS_STRING, SCNG(output_conv) TSRMLS_CC)) { + if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), IS_UNICODE, SCNG(output_conv) TSRMLS_CC)) { return 0; } - if (UG(unicode) && !zend_check_and_normalize_identifier(zendlval)) { + if (!zend_check_and_normalize_identifier(zendlval)) { return 0; } return T_VARIABLE; } -#line 4864 "Zend/zend_language_scanner.c" +#line 4848 "Zend/zend_language_scanner.c" yy316: YYDEBUG(316, *YYCURSOR); yych = *++YYCURSOR; @@ -4874,11 +4858,11 @@ yy317: } YYDEBUG(318, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1805 "Zend/zend_language_scanner.l" +#line 1799 "Zend/zend_language_scanner.l" { return T_LOGICAL_XOR; } -#line 4882 "Zend/zend_language_scanner.c" +#line 4866 "Zend/zend_language_scanner.c" yy319: YYDEBUG(319, *YYCURSOR); ++YYCURSOR; @@ -4887,61 +4871,61 @@ yy319: } YYDEBUG(320, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1797 "Zend/zend_language_scanner.l" +#line 1791 "Zend/zend_language_scanner.l" { return T_LOGICAL_OR; } -#line 4895 "Zend/zend_language_scanner.c" +#line 4879 "Zend/zend_language_scanner.c" yy321: YYDEBUG(321, *YYCURSOR); ++YYCURSOR; YYDEBUG(322, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1785 "Zend/zend_language_scanner.l" +#line 1779 "Zend/zend_language_scanner.l" { return T_XOR_EQUAL; } -#line 4905 "Zend/zend_language_scanner.c" +#line 4889 "Zend/zend_language_scanner.c" yy323: YYDEBUG(323, *YYCURSOR); ++YYCURSOR; YYDEBUG(324, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1789 "Zend/zend_language_scanner.l" +#line 1783 "Zend/zend_language_scanner.l" { return T_BOOLEAN_OR; } -#line 4915 "Zend/zend_language_scanner.c" +#line 4899 "Zend/zend_language_scanner.c" yy325: YYDEBUG(325, *YYCURSOR); ++YYCURSOR; YYDEBUG(326, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1781 "Zend/zend_language_scanner.l" +#line 1775 "Zend/zend_language_scanner.l" { return T_OR_EQUAL; } -#line 4925 "Zend/zend_language_scanner.c" +#line 4909 "Zend/zend_language_scanner.c" yy327: YYDEBUG(327, *YYCURSOR); ++YYCURSOR; YYDEBUG(328, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1793 "Zend/zend_language_scanner.l" +#line 1787 "Zend/zend_language_scanner.l" { return T_BOOLEAN_AND; } -#line 4935 "Zend/zend_language_scanner.c" +#line 4919 "Zend/zend_language_scanner.c" yy329: YYDEBUG(329, *YYCURSOR); ++YYCURSOR; YYDEBUG(330, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1777 "Zend/zend_language_scanner.l" +#line 1771 "Zend/zend_language_scanner.l" { return T_AND_EQUAL; } -#line 4945 "Zend/zend_language_scanner.c" +#line 4929 "Zend/zend_language_scanner.c" yy331: YYDEBUG(331, *YYCURSOR); ++YYCURSOR; @@ -4950,7 +4934,7 @@ yy331: yy332: YYDEBUG(332, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2343 "Zend/zend_language_scanner.l" +#line 2319 "Zend/zend_language_scanner.l" { if (CG(asp_tags)) { BEGIN(INITIAL); @@ -4963,17 +4947,17 @@ yy332: return yytext[0]; } } -#line 4967 "Zend/zend_language_scanner.c" +#line 4951 "Zend/zend_language_scanner.c" yy333: YYDEBUG(333, *YYCURSOR); ++YYCURSOR; YYDEBUG(334, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1765 "Zend/zend_language_scanner.l" +#line 1759 "Zend/zend_language_scanner.l" { return T_MOD_EQUAL; } -#line 4977 "Zend/zend_language_scanner.c" +#line 4961 "Zend/zend_language_scanner.c" yy335: YYDEBUG(335, *YYCURSOR); yych = *++YYCURSOR; @@ -5004,11 +4988,11 @@ yy339: ++YYCURSOR; YYDEBUG(340, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1761 "Zend/zend_language_scanner.l" +#line 1755 "Zend/zend_language_scanner.l" { return T_CONCAT_EQUAL; } -#line 5012 "Zend/zend_language_scanner.c" +#line 4996 "Zend/zend_language_scanner.c" yy341: YYDEBUG(341, *YYCURSOR); yyaccept = 6; @@ -5017,12 +5001,12 @@ yy341: yy342: YYDEBUG(342, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2301 "Zend/zend_language_scanner.l" +#line 2277 "Zend/zend_language_scanner.l" { BEGIN(ST_COMMENT); yymore(); } -#line 5026 "Zend/zend_language_scanner.c" +#line 5010 "Zend/zend_language_scanner.c" yy343: YYDEBUG(343, *YYCURSOR); yych = *++YYCURSOR; @@ -5032,11 +5016,11 @@ yy344: ++YYCURSOR; YYDEBUG(345, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1757 "Zend/zend_language_scanner.l" +#line 1751 "Zend/zend_language_scanner.l" { return T_DIV_EQUAL; } -#line 5040 "Zend/zend_language_scanner.c" +#line 5024 "Zend/zend_language_scanner.c" yy346: YYDEBUG(346, *YYCURSOR); yych = *++YYCURSOR; @@ -5055,54 +5039,54 @@ yy347: } YYDEBUG(349, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2290 "Zend/zend_language_scanner.l" +#line 2266 "Zend/zend_language_scanner.l" { RESET_DOC_COMMENT(); BEGIN(ST_DOC_COMMENT); yymore(); } -#line 5065 "Zend/zend_language_scanner.c" +#line 5049 "Zend/zend_language_scanner.c" yy350: YYDEBUG(350, *YYCURSOR); ++YYCURSOR; YYDEBUG(351, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1753 "Zend/zend_language_scanner.l" +#line 1747 "Zend/zend_language_scanner.l" { return T_MUL_EQUAL; } -#line 5075 "Zend/zend_language_scanner.c" +#line 5059 "Zend/zend_language_scanner.c" yy352: YYDEBUG(352, *YYCURSOR); ++YYCURSOR; if ((yych = *YYCURSOR) == '=') goto yy356; YYDEBUG(353, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1813 "Zend/zend_language_scanner.l" +#line 1807 "Zend/zend_language_scanner.l" { return T_SR; } -#line 5086 "Zend/zend_language_scanner.c" +#line 5070 "Zend/zend_language_scanner.c" yy354: YYDEBUG(354, *YYCURSOR); ++YYCURSOR; YYDEBUG(355, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1741 "Zend/zend_language_scanner.l" +#line 1735 "Zend/zend_language_scanner.l" { return T_IS_GREATER_OR_EQUAL; } -#line 5096 "Zend/zend_language_scanner.c" +#line 5080 "Zend/zend_language_scanner.c" yy356: YYDEBUG(356, *YYCURSOR); ++YYCURSOR; YYDEBUG(357, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1773 "Zend/zend_language_scanner.l" +#line 1767 "Zend/zend_language_scanner.l" { return T_SR_EQUAL; } -#line 5106 "Zend/zend_language_scanner.c" +#line 5090 "Zend/zend_language_scanner.c" yy358: YYDEBUG(358, *YYCURSOR); yyaccept = 7; @@ -5113,11 +5097,11 @@ yy358: yy359: YYDEBUG(359, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1809 "Zend/zend_language_scanner.l" +#line 1803 "Zend/zend_language_scanner.l" { return T_SL; } -#line 5121 "Zend/zend_language_scanner.c" +#line 5105 "Zend/zend_language_scanner.c" yy360: YYDEBUG(360, *YYCURSOR); yych = *++YYCURSOR; @@ -5129,22 +5113,22 @@ yy361: ++YYCURSOR; YYDEBUG(362, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1737 "Zend/zend_language_scanner.l" +#line 1731 "Zend/zend_language_scanner.l" { return T_IS_SMALLER_OR_EQUAL; } -#line 5137 "Zend/zend_language_scanner.c" +#line 5121 "Zend/zend_language_scanner.c" yy363: YYDEBUG(363, *YYCURSOR); ++YYCURSOR; yy364: YYDEBUG(364, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1733 "Zend/zend_language_scanner.l" +#line 1727 "Zend/zend_language_scanner.l" { return T_IS_NOT_EQUAL; } -#line 5148 "Zend/zend_language_scanner.c" +#line 5132 "Zend/zend_language_scanner.c" yy365: YYDEBUG(365, *YYCURSOR); yych = *++YYCURSOR; @@ -5195,11 +5179,11 @@ yy372: ++YYCURSOR; YYDEBUG(373, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1769 "Zend/zend_language_scanner.l" +#line 1763 "Zend/zend_language_scanner.l" { return T_SL_EQUAL; } -#line 5203 "Zend/zend_language_scanner.c" +#line 5187 "Zend/zend_language_scanner.c" yy374: YYDEBUG(374, *YYCURSOR); ++YYCURSOR; @@ -5304,7 +5288,7 @@ yy383: yy384: YYDEBUG(384, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2401 "Zend/zend_language_scanner.l" +#line 2367 "Zend/zend_language_scanner.l" { char *s; int bprefix = (yytext[0] != '<') ? 1 : 0; @@ -5352,7 +5336,7 @@ yy384: return bprefix ? T_BINARY_HEREDOC : T_START_HEREDOC; } -#line 5356 "Zend/zend_language_scanner.c" +#line 5340 "Zend/zend_language_scanner.c" yy385: YYDEBUG(385, *YYCURSOR); yych = *++YYCURSOR; @@ -5392,31 +5376,31 @@ yy388: ++YYCURSOR; YYDEBUG(390, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1725 "Zend/zend_language_scanner.l" +#line 1719 "Zend/zend_language_scanner.l" { return T_IS_NOT_IDENTICAL; } -#line 5400 "Zend/zend_language_scanner.c" +#line 5384 "Zend/zend_language_scanner.c" yy391: YYDEBUG(391, *YYCURSOR); ++YYCURSOR; YYDEBUG(392, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1745 "Zend/zend_language_scanner.l" +#line 1739 "Zend/zend_language_scanner.l" { return T_PLUS_EQUAL; } -#line 5410 "Zend/zend_language_scanner.c" +#line 5394 "Zend/zend_language_scanner.c" yy393: YYDEBUG(393, *YYCURSOR); ++YYCURSOR; YYDEBUG(394, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1713 "Zend/zend_language_scanner.l" +#line 1707 "Zend/zend_language_scanner.l" { return T_INC; } -#line 5420 "Zend/zend_language_scanner.c" +#line 5404 "Zend/zend_language_scanner.c" yy395: YYDEBUG(395, *YYCURSOR); yych = *++YYCURSOR; @@ -5435,42 +5419,42 @@ yy397: } YYDEBUG(398, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1705 "Zend/zend_language_scanner.l" +#line 1699 "Zend/zend_language_scanner.l" { return T_LIST; } -#line 5443 "Zend/zend_language_scanner.c" +#line 5427 "Zend/zend_language_scanner.c" yy399: YYDEBUG(399, *YYCURSOR); ++YYCURSOR; if ((yych = *YYCURSOR) == '=') goto yy403; YYDEBUG(400, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1729 "Zend/zend_language_scanner.l" +#line 1723 "Zend/zend_language_scanner.l" { return T_IS_EQUAL; } -#line 5454 "Zend/zend_language_scanner.c" +#line 5438 "Zend/zend_language_scanner.c" yy401: YYDEBUG(401, *YYCURSOR); ++YYCURSOR; YYDEBUG(402, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1701 "Zend/zend_language_scanner.l" +#line 1695 "Zend/zend_language_scanner.l" { return T_DOUBLE_ARROW; } -#line 5464 "Zend/zend_language_scanner.c" +#line 5448 "Zend/zend_language_scanner.c" yy403: YYDEBUG(403, *YYCURSOR); ++YYCURSOR; YYDEBUG(404, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1721 "Zend/zend_language_scanner.l" +#line 1715 "Zend/zend_language_scanner.l" { return T_IS_IDENTICAL; } -#line 5474 "Zend/zend_language_scanner.c" +#line 5458 "Zend/zend_language_scanner.c" yy405: YYDEBUG(405, *YYCURSOR); yych = *++YYCURSOR; @@ -5592,7 +5576,7 @@ yy420: } YYDEBUG(423, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2053 "Zend/zend_language_scanner.l" +#line 2029 "Zend/zend_language_scanner.l" { if (CG(current_namespace)) { *zendlval = *CG(current_namespace); @@ -5602,7 +5586,7 @@ yy420: } return T_NS_C; } -#line 5606 "Zend/zend_language_scanner.c" +#line 5590 "Zend/zend_language_scanner.c" yy424: YYDEBUG(424, *YYCURSOR); yych = *++YYCURSOR; @@ -5622,7 +5606,7 @@ yy425: } YYDEBUG(428, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2026 "Zend/zend_language_scanner.l" +#line 2002 "Zend/zend_language_scanner.l" { char *filename = zend_get_compiled_filename(TSRMLS_C); const size_t filename_len = strlen(filename); @@ -5649,7 +5633,7 @@ yy425: zendlval->type = IS_STRING; return T_DIR; } -#line 5653 "Zend/zend_language_scanner.c" +#line 5637 "Zend/zend_language_scanner.c" yy429: YYDEBUG(429, *YYCURSOR); yych = *++YYCURSOR; @@ -5674,13 +5658,13 @@ yy431: } YYDEBUG(434, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2010 "Zend/zend_language_scanner.l" +#line 1986 "Zend/zend_language_scanner.l" { Z_LVAL_P(zendlval) = CG(zend_lineno); Z_TYPE_P(zendlval) = IS_LONG; return T_LINE; } -#line 5684 "Zend/zend_language_scanner.c" +#line 5668 "Zend/zend_language_scanner.c" yy435: YYDEBUG(435, *YYCURSOR); yych = *++YYCURSOR; @@ -5715,56 +5699,38 @@ yy439: } YYDEBUG(442, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1961 "Zend/zend_language_scanner.l" +#line 1955 "Zend/zend_language_scanner.l" { zstr class_name = CG(active_class_entry) ? CG(active_class_entry)->name : NULL_ZSTR; zstr func_name = CG(active_op_array)? CG(active_op_array)->function_name : NULL_ZSTR; size_t len = 0; + size_t len1; - if (UG(unicode)) { - size_t len1; - - if (class_name.u) { - len += len1 = u_strlen(class_name.u); - len += 2; - } - if (func_name.u) { - len += u_strlen(func_name.u); - } else { - func_name.u = EMPTY_STR; - } - Z_USTRLEN_P(zendlval) = len; - Z_USTRVAL_P(zendlval) = eumalloc(len+1); - 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), func_name.u); - Z_TYPE_P(zendlval) = IS_UNICODE; + if (class_name.u) { + len += len1 = u_strlen(class_name.u); + len += 2; + } + if (func_name.u) { + len += u_strlen(func_name.u); } else { - if (class_name.s) { - len += strlen(class_name.s) + 2; - } - 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.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; + func_name.u = EMPTY_STR; } + Z_USTRLEN_P(zendlval) = len; + Z_USTRVAL_P(zendlval) = eumalloc(len+1); + 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), func_name.u); + Z_TYPE_P(zendlval) = IS_UNICODE; + return T_METHOD_C; } -#line 5768 "Zend/zend_language_scanner.c" +#line 5734 "Zend/zend_language_scanner.c" yy443: YYDEBUG(443, *YYCURSOR); yych = *++YYCURSOR; @@ -5815,7 +5781,7 @@ yy450: } YYDEBUG(453, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1946 "Zend/zend_language_scanner.l" +#line 1940 "Zend/zend_language_scanner.l" { zstr func_name = NULL_ZSTR; @@ -5830,7 +5796,7 @@ yy450: } return T_FUNC_C; } -#line 5834 "Zend/zend_language_scanner.c" +#line 5800 "Zend/zend_language_scanner.c" yy454: YYDEBUG(454, *YYCURSOR); yych = *++YYCURSOR; @@ -5850,7 +5816,7 @@ yy455: } YYDEBUG(458, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2016 "Zend/zend_language_scanner.l" +#line 1992 "Zend/zend_language_scanner.l" { char *filename = zend_get_compiled_filename(TSRMLS_C); @@ -5860,7 +5826,7 @@ yy455: ZVAL_RT_STRING(zendlval, filename, 1); return T_FILE; } -#line 5864 "Zend/zend_language_scanner.c" +#line 5830 "Zend/zend_language_scanner.c" yy459: YYDEBUG(459, *YYCURSOR); yych = *++YYCURSOR; @@ -5890,7 +5856,7 @@ yy462: } YYDEBUG(465, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1931 "Zend/zend_language_scanner.l" +#line 1925 "Zend/zend_language_scanner.l" { zstr class_name = NULL_ZSTR; @@ -5905,7 +5871,7 @@ yy462: } return T_CLASS_C; } -#line 5909 "Zend/zend_language_scanner.c" +#line 5875 "Zend/zend_language_scanner.c" yy466: YYDEBUG(466, *YYCURSOR); yych = *++YYCURSOR; @@ -5967,11 +5933,11 @@ yy477: } YYDEBUG(478, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1669 "Zend/zend_language_scanner.l" +#line 1663 "Zend/zend_language_scanner.l" { return T_HALT_COMPILER; } -#line 5975 "Zend/zend_language_scanner.c" +#line 5941 "Zend/zend_language_scanner.c" yy479: YYDEBUG(479, *YYCURSOR); yych = *++YYCURSOR; @@ -5991,11 +5957,11 @@ yy481: } YYDEBUG(482, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1653 "Zend/zend_language_scanner.l" +#line 1647 "Zend/zend_language_scanner.l" { return T_USE; } -#line 5999 "Zend/zend_language_scanner.c" +#line 5965 "Zend/zend_language_scanner.c" yy483: YYDEBUG(483, *YYCURSOR); yych = *++YYCURSOR; @@ -6014,11 +5980,11 @@ yy485: } YYDEBUG(486, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1697 "Zend/zend_language_scanner.l" +#line 1691 "Zend/zend_language_scanner.l" { return T_UNSET; } -#line 6022 "Zend/zend_language_scanner.c" +#line 5988 "Zend/zend_language_scanner.c" yy487: YYDEBUG(487, *YYCURSOR); ++YYCURSOR; @@ -6190,11 +6156,11 @@ yy502: ++YYCURSOR; YYDEBUG(504, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1593 "Zend/zend_language_scanner.l" +#line 1587 "Zend/zend_language_scanner.l" { return T_INT_CAST; } -#line 6198 "Zend/zend_language_scanner.c" +#line 6164 "Zend/zend_language_scanner.c" yy505: YYDEBUG(505, *YYCURSOR); yych = *++YYCURSOR; @@ -6238,11 +6204,11 @@ yy510: ++YYCURSOR; YYDEBUG(513, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1597 "Zend/zend_language_scanner.l" +#line 1591 "Zend/zend_language_scanner.l" { return T_DOUBLE_CAST; } -#line 6246 "Zend/zend_language_scanner.c" +#line 6212 "Zend/zend_language_scanner.c" yy514: YYDEBUG(514, *YYCURSOR); yych = *++YYCURSOR; @@ -6312,11 +6278,11 @@ yy524: ++YYCURSOR; YYDEBUG(527, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1601 "Zend/zend_language_scanner.l" +#line 1595 "Zend/zend_language_scanner.l" { return T_STRING_CAST; } -#line 6320 "Zend/zend_language_scanner.c" +#line 6286 "Zend/zend_language_scanner.c" yy528: YYDEBUG(528, *YYCURSOR); yych = *++YYCURSOR; @@ -6349,11 +6315,11 @@ yy531: ++YYCURSOR; YYDEBUG(534, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1613 "Zend/zend_language_scanner.l" +#line 1607 "Zend/zend_language_scanner.l" { return T_ARRAY_CAST; } -#line 6357 "Zend/zend_language_scanner.c" +#line 6323 "Zend/zend_language_scanner.c" yy535: YYDEBUG(535, *YYCURSOR); yych = *++YYCURSOR; @@ -6391,11 +6357,11 @@ yy539: ++YYCURSOR; YYDEBUG(542, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1617 "Zend/zend_language_scanner.l" +#line 1611 "Zend/zend_language_scanner.l" { return T_OBJECT_CAST; } -#line 6399 "Zend/zend_language_scanner.c" +#line 6365 "Zend/zend_language_scanner.c" yy543: YYDEBUG(543, *YYCURSOR); yych = *++YYCURSOR; @@ -6436,11 +6402,11 @@ yy548: ++YYCURSOR; YYDEBUG(550, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1621 "Zend/zend_language_scanner.l" +#line 1615 "Zend/zend_language_scanner.l" { return T_BOOL_CAST; } -#line 6444 "Zend/zend_language_scanner.c" +#line 6410 "Zend/zend_language_scanner.c" yy551: YYDEBUG(551, *YYCURSOR); yych = *++YYCURSOR; @@ -6484,11 +6450,11 @@ yy556: ++YYCURSOR; YYDEBUG(559, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1609 "Zend/zend_language_scanner.l" +#line 1603 "Zend/zend_language_scanner.l" { return T_BINARY_CAST; } -#line 6492 "Zend/zend_language_scanner.c" +#line 6458 "Zend/zend_language_scanner.c" yy560: YYDEBUG(560, *YYCURSOR); yych = *++YYCURSOR; @@ -6545,11 +6511,11 @@ yy566: ++YYCURSOR; YYDEBUG(569, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1605 "Zend/zend_language_scanner.l" +#line 1599 "Zend/zend_language_scanner.l" { return T_UNICODE_CAST; } -#line 6553 "Zend/zend_language_scanner.c" +#line 6519 "Zend/zend_language_scanner.c" yy570: YYDEBUG(570, *YYCURSOR); yych = *++YYCURSOR; @@ -6572,11 +6538,11 @@ yy571: ++YYCURSOR; YYDEBUG(574, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1625 "Zend/zend_language_scanner.l" +#line 1619 "Zend/zend_language_scanner.l" { return T_UNSET_CAST; } -#line 6580 "Zend/zend_language_scanner.c" +#line 6546 "Zend/zend_language_scanner.c" yy575: YYDEBUG(575, *YYCURSOR); yych = *++YYCURSOR; @@ -6590,11 +6556,11 @@ yy576: } YYDEBUG(577, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1589 "Zend/zend_language_scanner.l" +#line 1583 "Zend/zend_language_scanner.l" { return T_VAR; } -#line 6598 "Zend/zend_language_scanner.c" +#line 6564 "Zend/zend_language_scanner.c" yy578: YYDEBUG(578, *YYCURSOR); yych = *++YYCURSOR; @@ -6614,11 +6580,11 @@ yy580: } YYDEBUG(581, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1581 "Zend/zend_language_scanner.l" +#line 1575 "Zend/zend_language_scanner.l" { return T_NEW; } -#line 6622 "Zend/zend_language_scanner.c" +#line 6588 "Zend/zend_language_scanner.c" yy582: YYDEBUG(582, *YYCURSOR); yych = *++YYCURSOR; @@ -6657,21 +6623,21 @@ yy588: } YYDEBUG(589, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1649 "Zend/zend_language_scanner.l" +#line 1643 "Zend/zend_language_scanner.l" { return T_NAMESPACE; } -#line 6665 "Zend/zend_language_scanner.c" +#line 6631 "Zend/zend_language_scanner.c" yy590: YYDEBUG(590, *YYCURSOR); ++YYCURSOR; YYDEBUG(591, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1573 "Zend/zend_language_scanner.l" +#line 1567 "Zend/zend_language_scanner.l" { return T_PAAMAYIM_NEKUDOTAYIM; } -#line 6675 "Zend/zend_language_scanner.c" +#line 6641 "Zend/zend_language_scanner.c" yy592: YYDEBUG(592, *YYCURSOR); ++YYCURSOR; @@ -6693,32 +6659,32 @@ yy594: ++YYCURSOR; YYDEBUG(595, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1749 "Zend/zend_language_scanner.l" +#line 1743 "Zend/zend_language_scanner.l" { return T_MINUS_EQUAL; } -#line 6701 "Zend/zend_language_scanner.c" +#line 6667 "Zend/zend_language_scanner.c" yy596: YYDEBUG(596, *YYCURSOR); ++YYCURSOR; YYDEBUG(597, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1717 "Zend/zend_language_scanner.l" +#line 1711 "Zend/zend_language_scanner.l" { return T_DEC; } -#line 6711 "Zend/zend_language_scanner.c" +#line 6677 "Zend/zend_language_scanner.c" yy598: YYDEBUG(598, *YYCURSOR); ++YYCURSOR; YYDEBUG(599, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1539 "Zend/zend_language_scanner.l" +#line 1533 "Zend/zend_language_scanner.l" { yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); return T_OBJECT_OPERATOR; } -#line 6722 "Zend/zend_language_scanner.c" +#line 6688 "Zend/zend_language_scanner.c" yy600: YYDEBUG(600, *YYCURSOR); yych = *++YYCURSOR; @@ -6763,11 +6729,11 @@ yy605: } YYDEBUG(606, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1693 "Zend/zend_language_scanner.l" +#line 1687 "Zend/zend_language_scanner.l" { return T_PUBLIC; } -#line 6771 "Zend/zend_language_scanner.c" +#line 6737 "Zend/zend_language_scanner.c" yy607: YYDEBUG(607, *YYCURSOR); yych = *++YYCURSOR; @@ -6822,11 +6788,11 @@ yy614: } YYDEBUG(615, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1689 "Zend/zend_language_scanner.l" +#line 1683 "Zend/zend_language_scanner.l" { return T_PROTECTED; } -#line 6830 "Zend/zend_language_scanner.c" +#line 6796 "Zend/zend_language_scanner.c" yy616: YYDEBUG(616, *YYCURSOR); yych = *++YYCURSOR; @@ -6856,11 +6822,11 @@ yy620: } YYDEBUG(621, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1685 "Zend/zend_language_scanner.l" +#line 1679 "Zend/zend_language_scanner.l" { return T_PRIVATE; } -#line 6864 "Zend/zend_language_scanner.c" +#line 6830 "Zend/zend_language_scanner.c" yy622: YYDEBUG(622, *YYCURSOR); ++YYCURSOR; @@ -6869,11 +6835,11 @@ yy622: } YYDEBUG(623, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1519 "Zend/zend_language_scanner.l" +#line 1513 "Zend/zend_language_scanner.l" { return T_PRINT; } -#line 6877 "Zend/zend_language_scanner.c" +#line 6843 "Zend/zend_language_scanner.c" yy624: YYDEBUG(624, *YYCURSOR); yych = *++YYCURSOR; @@ -6898,11 +6864,11 @@ yy627: } YYDEBUG(628, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1511 "Zend/zend_language_scanner.l" +#line 1505 "Zend/zend_language_scanner.l" { return T_GOTO; } -#line 6906 "Zend/zend_language_scanner.c" +#line 6872 "Zend/zend_language_scanner.c" yy629: YYDEBUG(629, *YYCURSOR); yych = *++YYCURSOR; @@ -6926,11 +6892,11 @@ yy632: } YYDEBUG(633, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1657 "Zend/zend_language_scanner.l" +#line 1651 "Zend/zend_language_scanner.l" { return T_GLOBAL; } -#line 6934 "Zend/zend_language_scanner.c" +#line 6900 "Zend/zend_language_scanner.c" yy634: YYDEBUG(634, *YYCURSOR); yych = *++YYCURSOR; @@ -6944,12 +6910,12 @@ yy635: yy636: YYDEBUG(636, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2396 "Zend/zend_language_scanner.l" +#line 2362 "Zend/zend_language_scanner.l" { BEGIN(ST_DOUBLE_QUOTES); return T_BINARY_DOUBLE; } -#line 6953 "Zend/zend_language_scanner.c" +#line 6919 "Zend/zend_language_scanner.c" yy637: YYDEBUG(637, *YYCURSOR); ++YYCURSOR; @@ -6982,11 +6948,11 @@ yy642: } YYDEBUG(643, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1503 "Zend/zend_language_scanner.l" +#line 1497 "Zend/zend_language_scanner.l" { return T_BREAK; } -#line 6990 "Zend/zend_language_scanner.c" +#line 6956 "Zend/zend_language_scanner.c" yy644: YYDEBUG(644, *YYCURSOR); ++YYCURSOR; @@ -6999,12 +6965,12 @@ yy645: ++YYCURSOR; YYDEBUG(646, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2385 "Zend/zend_language_scanner.l" +#line 2351 "Zend/zend_language_scanner.l" { zend_scan_binary_single_string(zendlval, yytext+2, yyleng-3 TSRMLS_CC); return T_CONSTANT_ENCAPSED_STRING; } -#line 7008 "Zend/zend_language_scanner.c" +#line 6974 "Zend/zend_language_scanner.c" yy647: YYDEBUG(647, *YYCURSOR); ++YYCURSOR; @@ -7079,12 +7045,12 @@ yy654: ++YYCURSOR; YYDEBUG(655, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2369 "Zend/zend_language_scanner.l" +#line 2340 "Zend/zend_language_scanner.l" { zend_scan_binary_escape_string(zendlval, yytext+2, yyleng-3, '"' TSRMLS_CC); return T_CONSTANT_ENCAPSED_STRING; } -#line 7088 "Zend/zend_language_scanner.c" +#line 7054 "Zend/zend_language_scanner.c" yy656: YYDEBUG(656, *YYCURSOR); ++YYCURSOR; @@ -7131,11 +7097,11 @@ yy663: } YYDEBUG(664, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1487 "Zend/zend_language_scanner.l" +#line 1481 "Zend/zend_language_scanner.l" { return T_SWITCH; } -#line 7139 "Zend/zend_language_scanner.c" +#line 7105 "Zend/zend_language_scanner.c" yy665: YYDEBUG(665, *YYCURSOR); yych = *++YYCURSOR; @@ -7159,11 +7125,11 @@ yy668: } YYDEBUG(669, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1673 "Zend/zend_language_scanner.l" +#line 1667 "Zend/zend_language_scanner.l" { return T_STATIC; } -#line 7167 "Zend/zend_language_scanner.c" +#line 7133 "Zend/zend_language_scanner.c" yy670: YYDEBUG(670, *YYCURSOR); yych = *++YYCURSOR; @@ -7190,11 +7156,11 @@ yy673: } YYDEBUG(674, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1483 "Zend/zend_language_scanner.l" +#line 1477 "Zend/zend_language_scanner.l" { return T_AS; } -#line 7198 "Zend/zend_language_scanner.c" +#line 7164 "Zend/zend_language_scanner.c" yy675: YYDEBUG(675, *YYCURSOR); yych = *++YYCURSOR; @@ -7213,11 +7179,11 @@ yy677: } YYDEBUG(678, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1709 "Zend/zend_language_scanner.l" +#line 1703 "Zend/zend_language_scanner.l" { return T_ARRAY; } -#line 7221 "Zend/zend_language_scanner.c" +#line 7187 "Zend/zend_language_scanner.c" yy679: YYDEBUG(679, *YYCURSOR); ++YYCURSOR; @@ -7226,11 +7192,11 @@ yy679: } YYDEBUG(680, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1801 "Zend/zend_language_scanner.l" +#line 1795 "Zend/zend_language_scanner.l" { return T_LOGICAL_AND; } -#line 7234 "Zend/zend_language_scanner.c" +#line 7200 "Zend/zend_language_scanner.c" yy681: YYDEBUG(681, *YYCURSOR); yych = *++YYCURSOR; @@ -7264,11 +7230,11 @@ yy686: } YYDEBUG(687, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1677 "Zend/zend_language_scanner.l" +#line 1671 "Zend/zend_language_scanner.l" { return T_ABSTRACT; } -#line 7272 "Zend/zend_language_scanner.c" +#line 7238 "Zend/zend_language_scanner.c" yy688: YYDEBUG(688, *YYCURSOR); yych = *++YYCURSOR; @@ -7292,11 +7258,11 @@ yy691: } YYDEBUG(692, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1443 "Zend/zend_language_scanner.l" +#line 1437 "Zend/zend_language_scanner.l" { return T_WHILE; } -#line 7300 "Zend/zend_language_scanner.c" +#line 7266 "Zend/zend_language_scanner.c" yy693: YYDEBUG(693, *YYCURSOR); ++YYCURSOR; @@ -7305,11 +7271,11 @@ yy693: } YYDEBUG(694, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1427 "Zend/zend_language_scanner.l" +#line 1421 "Zend/zend_language_scanner.l" { return T_IF; } -#line 7313 "Zend/zend_language_scanner.c" +#line 7279 "Zend/zend_language_scanner.c" yy695: YYDEBUG(695, *YYCURSOR); yych = *++YYCURSOR; @@ -7361,11 +7327,11 @@ yy700: } YYDEBUG(701, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1661 "Zend/zend_language_scanner.l" +#line 1655 "Zend/zend_language_scanner.l" { return T_ISSET; } -#line 7369 "Zend/zend_language_scanner.c" +#line 7335 "Zend/zend_language_scanner.c" yy702: YYDEBUG(702, *YYCURSOR); yych = *++YYCURSOR; @@ -7419,11 +7385,11 @@ yy708: yy709: YYDEBUG(709, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1633 "Zend/zend_language_scanner.l" +#line 1627 "Zend/zend_language_scanner.l" { return T_INCLUDE; } -#line 7427 "Zend/zend_language_scanner.c" +#line 7393 "Zend/zend_language_scanner.c" yy710: YYDEBUG(710, *YYCURSOR); yych = *++YYCURSOR; @@ -7452,11 +7418,11 @@ yy714: } YYDEBUG(715, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1637 "Zend/zend_language_scanner.l" +#line 1631 "Zend/zend_language_scanner.l" { return T_INCLUDE_ONCE; } -#line 7460 "Zend/zend_language_scanner.c" +#line 7426 "Zend/zend_language_scanner.c" yy716: YYDEBUG(716, *YYCURSOR); yych = *++YYCURSOR; @@ -7490,11 +7456,11 @@ yy721: } YYDEBUG(722, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1527 "Zend/zend_language_scanner.l" +#line 1521 "Zend/zend_language_scanner.l" { return T_INTERFACE; } -#line 7498 "Zend/zend_language_scanner.c" +#line 7464 "Zend/zend_language_scanner.c" yy723: YYDEBUG(723, *YYCURSOR); yych = *++YYCURSOR; @@ -7533,11 +7499,11 @@ yy729: } YYDEBUG(730, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1479 "Zend/zend_language_scanner.l" +#line 1473 "Zend/zend_language_scanner.l" { return T_INSTANCEOF; } -#line 7541 "Zend/zend_language_scanner.c" +#line 7507 "Zend/zend_language_scanner.c" yy731: YYDEBUG(731, *YYCURSOR); yych = *++YYCURSOR; @@ -7581,11 +7547,11 @@ yy738: } YYDEBUG(739, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1535 "Zend/zend_language_scanner.l" +#line 1529 "Zend/zend_language_scanner.l" { return T_IMPLEMENTS; } -#line 7589 "Zend/zend_language_scanner.c" +#line 7555 "Zend/zend_language_scanner.c" yy740: YYDEBUG(740, *YYCURSOR); yych = *++YYCURSOR; @@ -7605,11 +7571,11 @@ yy742: } YYDEBUG(743, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1415 "Zend/zend_language_scanner.l" +#line 1409 "Zend/zend_language_scanner.l" { return T_TRY; } -#line 7613 "Zend/zend_language_scanner.c" +#line 7579 "Zend/zend_language_scanner.c" yy744: YYDEBUG(744, *YYCURSOR); yych = *++YYCURSOR; @@ -7628,11 +7594,11 @@ yy746: } YYDEBUG(747, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1423 "Zend/zend_language_scanner.l" +#line 1417 "Zend/zend_language_scanner.l" { return T_THROW; } -#line 7636 "Zend/zend_language_scanner.c" +#line 7602 "Zend/zend_language_scanner.c" yy748: YYDEBUG(748, *YYCURSOR); yych = *++YYCURSOR; @@ -7693,11 +7659,11 @@ yy754: yy755: YYDEBUG(755, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1641 "Zend/zend_language_scanner.l" +#line 1635 "Zend/zend_language_scanner.l" { return T_REQUIRE; } -#line 7701 "Zend/zend_language_scanner.c" +#line 7667 "Zend/zend_language_scanner.c" yy756: YYDEBUG(756, *YYCURSOR); yych = *++YYCURSOR; @@ -7726,11 +7692,11 @@ yy760: } YYDEBUG(761, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1645 "Zend/zend_language_scanner.l" +#line 1639 "Zend/zend_language_scanner.l" { return T_REQUIRE_ONCE; } -#line 7734 "Zend/zend_language_scanner.c" +#line 7700 "Zend/zend_language_scanner.c" yy762: YYDEBUG(762, *YYCURSOR); yych = *++YYCURSOR; @@ -7749,11 +7715,11 @@ yy764: } YYDEBUG(765, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1411 "Zend/zend_language_scanner.l" +#line 1405 "Zend/zend_language_scanner.l" { return T_RETURN; } -#line 7757 "Zend/zend_language_scanner.c" +#line 7723 "Zend/zend_language_scanner.c" yy766: YYDEBUG(766, *YYCURSOR); yych = *++YYCURSOR; @@ -7834,11 +7800,11 @@ yy775: } YYDEBUG(776, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1507 "Zend/zend_language_scanner.l" +#line 1501 "Zend/zend_language_scanner.l" { return T_CONTINUE; } -#line 7842 "Zend/zend_language_scanner.c" +#line 7808 "Zend/zend_language_scanner.c" yy777: YYDEBUG(777, *YYCURSOR); ++YYCURSOR; @@ -7847,11 +7813,11 @@ yy777: } YYDEBUG(778, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1407 "Zend/zend_language_scanner.l" +#line 1401 "Zend/zend_language_scanner.l" { return T_CONST; } -#line 7855 "Zend/zend_language_scanner.c" +#line 7821 "Zend/zend_language_scanner.c" yy779: YYDEBUG(779, *YYCURSOR); yych = *++YYCURSOR; @@ -7876,11 +7842,11 @@ yy782: } YYDEBUG(783, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1585 "Zend/zend_language_scanner.l" +#line 1579 "Zend/zend_language_scanner.l" { return T_CLONE; } -#line 7884 "Zend/zend_language_scanner.c" +#line 7850 "Zend/zend_language_scanner.c" yy784: YYDEBUG(784, *YYCURSOR); yych = *++YYCURSOR; @@ -7894,11 +7860,11 @@ yy785: } YYDEBUG(786, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1523 "Zend/zend_language_scanner.l" +#line 1517 "Zend/zend_language_scanner.l" { return T_CLASS; } -#line 7902 "Zend/zend_language_scanner.c" +#line 7868 "Zend/zend_language_scanner.c" yy787: YYDEBUG(787, *YYCURSOR); yych = *++YYCURSOR; @@ -7918,11 +7884,11 @@ yy789: } YYDEBUG(790, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1495 "Zend/zend_language_scanner.l" +#line 1489 "Zend/zend_language_scanner.l" { return T_CASE; } -#line 7926 "Zend/zend_language_scanner.c" +#line 7892 "Zend/zend_language_scanner.c" yy791: YYDEBUG(791, *YYCURSOR); yych = *++YYCURSOR; @@ -7936,11 +7902,11 @@ yy792: } YYDEBUG(793, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1419 "Zend/zend_language_scanner.l" +#line 1413 "Zend/zend_language_scanner.l" { return T_CATCH; } -#line 7944 "Zend/zend_language_scanner.c" +#line 7910 "Zend/zend_language_scanner.c" yy794: YYDEBUG(794, *YYCURSOR); yych = *++YYCURSOR; @@ -7991,11 +7957,11 @@ yy802: } YYDEBUG(803, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1403 "Zend/zend_language_scanner.l" +#line 1397 "Zend/zend_language_scanner.l" { return T_FUNCTION; } -#line 7999 "Zend/zend_language_scanner.c" +#line 7965 "Zend/zend_language_scanner.c" yy804: YYDEBUG(804, *YYCURSOR); ++YYCURSOR; @@ -8019,11 +7985,11 @@ yy804: yy805: YYDEBUG(805, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1455 "Zend/zend_language_scanner.l" +#line 1449 "Zend/zend_language_scanner.l" { return T_FOR; } -#line 8027 "Zend/zend_language_scanner.c" +#line 7993 "Zend/zend_language_scanner.c" yy806: YYDEBUG(806, *YYCURSOR); yych = *++YYCURSOR; @@ -8047,11 +8013,11 @@ yy809: } YYDEBUG(810, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1463 "Zend/zend_language_scanner.l" +#line 1457 "Zend/zend_language_scanner.l" { return T_FOREACH; } -#line 8055 "Zend/zend_language_scanner.c" +#line 8021 "Zend/zend_language_scanner.c" yy811: YYDEBUG(811, *YYCURSOR); yych = *++YYCURSOR; @@ -8070,11 +8036,11 @@ yy813: } YYDEBUG(814, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1681 "Zend/zend_language_scanner.l" +#line 1675 "Zend/zend_language_scanner.l" { return T_FINAL; } -#line 8078 "Zend/zend_language_scanner.c" +#line 8044 "Zend/zend_language_scanner.c" yy815: YYDEBUG(815, *YYCURSOR); yych = *++YYCURSOR; @@ -8105,11 +8071,11 @@ yy817: } YYDEBUG(818, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1451 "Zend/zend_language_scanner.l" +#line 1445 "Zend/zend_language_scanner.l" { return T_DO; } -#line 8113 "Zend/zend_language_scanner.c" +#line 8079 "Zend/zend_language_scanner.c" yy819: YYDEBUG(819, *YYCURSOR); ++YYCURSOR; @@ -8118,11 +8084,11 @@ yy819: } YYDEBUG(820, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1399 "Zend/zend_language_scanner.l" +#line 1393 "Zend/zend_language_scanner.l" { return T_EXIT; } -#line 8126 "Zend/zend_language_scanner.c" +#line 8092 "Zend/zend_language_scanner.c" yy821: YYDEBUG(821, *YYCURSOR); yych = *++YYCURSOR; @@ -8157,11 +8123,11 @@ yy826: } YYDEBUG(827, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1499 "Zend/zend_language_scanner.l" +#line 1493 "Zend/zend_language_scanner.l" { return T_DEFAULT; } -#line 8165 "Zend/zend_language_scanner.c" +#line 8131 "Zend/zend_language_scanner.c" yy828: YYDEBUG(828, *YYCURSOR); yych = *++YYCURSOR; @@ -8185,11 +8151,11 @@ yy831: } YYDEBUG(832, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1471 "Zend/zend_language_scanner.l" +#line 1465 "Zend/zend_language_scanner.l" { return T_DECLARE; } -#line 8193 "Zend/zend_language_scanner.c" +#line 8159 "Zend/zend_language_scanner.c" yy833: YYDEBUG(833, *YYCURSOR); yych = *++YYCURSOR; @@ -8269,11 +8235,11 @@ yy844: } YYDEBUG(845, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1531 "Zend/zend_language_scanner.l" +#line 1525 "Zend/zend_language_scanner.l" { return T_EXTENDS; } -#line 8277 "Zend/zend_language_scanner.c" +#line 8243 "Zend/zend_language_scanner.c" yy846: YYDEBUG(846, *YYCURSOR); ++YYCURSOR; @@ -8282,11 +8248,11 @@ yy846: } YYDEBUG(847, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1395 "Zend/zend_language_scanner.l" +#line 1389 "Zend/zend_language_scanner.l" { return T_EXIT; } -#line 8290 "Zend/zend_language_scanner.c" +#line 8256 "Zend/zend_language_scanner.c" yy848: YYDEBUG(848, *YYCURSOR); yych = *++YYCURSOR; @@ -8300,11 +8266,11 @@ yy849: } YYDEBUG(850, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1629 "Zend/zend_language_scanner.l" +#line 1623 "Zend/zend_language_scanner.l" { return T_EVAL; } -#line 8308 "Zend/zend_language_scanner.c" +#line 8274 "Zend/zend_language_scanner.c" yy851: YYDEBUG(851, *YYCURSOR); yych = *++YYCURSOR; @@ -8374,11 +8340,11 @@ yy860: } YYDEBUG(861, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1447 "Zend/zend_language_scanner.l" +#line 1441 "Zend/zend_language_scanner.l" { return T_ENDWHILE; } -#line 8382 "Zend/zend_language_scanner.c" +#line 8348 "Zend/zend_language_scanner.c" yy862: YYDEBUG(862, *YYCURSOR); yych = *++YYCURSOR; @@ -8407,11 +8373,11 @@ yy866: } YYDEBUG(867, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1491 "Zend/zend_language_scanner.l" +#line 1485 "Zend/zend_language_scanner.l" { return T_ENDSWITCH; } -#line 8415 "Zend/zend_language_scanner.c" +#line 8381 "Zend/zend_language_scanner.c" yy868: YYDEBUG(868, *YYCURSOR); ++YYCURSOR; @@ -8420,11 +8386,11 @@ yy868: } YYDEBUG(869, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1435 "Zend/zend_language_scanner.l" +#line 1429 "Zend/zend_language_scanner.l" { return T_ENDIF; } -#line 8428 "Zend/zend_language_scanner.c" +#line 8394 "Zend/zend_language_scanner.c" yy870: YYDEBUG(870, *YYCURSOR); yych = *++YYCURSOR; @@ -8453,11 +8419,11 @@ yy871: yy872: YYDEBUG(872, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1459 "Zend/zend_language_scanner.l" +#line 1453 "Zend/zend_language_scanner.l" { return T_ENDFOR; } -#line 8461 "Zend/zend_language_scanner.c" +#line 8427 "Zend/zend_language_scanner.c" yy873: YYDEBUG(873, *YYCURSOR); yych = *++YYCURSOR; @@ -8481,11 +8447,11 @@ yy876: } YYDEBUG(877, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1467 "Zend/zend_language_scanner.l" +#line 1461 "Zend/zend_language_scanner.l" { return T_ENDFOREACH; } -#line 8489 "Zend/zend_language_scanner.c" +#line 8455 "Zend/zend_language_scanner.c" yy878: YYDEBUG(878, *YYCURSOR); yych = *++YYCURSOR; @@ -8519,11 +8485,11 @@ yy883: } YYDEBUG(884, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1475 "Zend/zend_language_scanner.l" +#line 1469 "Zend/zend_language_scanner.l" { return T_ENDDECLARE; } -#line 8527 "Zend/zend_language_scanner.c" +#line 8493 "Zend/zend_language_scanner.c" yy885: YYDEBUG(885, *YYCURSOR); yych = *++YYCURSOR; @@ -8542,11 +8508,11 @@ yy887: } YYDEBUG(888, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1665 "Zend/zend_language_scanner.l" +#line 1659 "Zend/zend_language_scanner.l" { return T_EMPTY; } -#line 8550 "Zend/zend_language_scanner.c" +#line 8516 "Zend/zend_language_scanner.c" yy889: YYDEBUG(889, *YYCURSOR); yych = *++YYCURSOR; @@ -8575,11 +8541,11 @@ yy890: yy891: YYDEBUG(891, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1439 "Zend/zend_language_scanner.l" +#line 1433 "Zend/zend_language_scanner.l" { return T_ELSE; } -#line 8583 "Zend/zend_language_scanner.c" +#line 8549 "Zend/zend_language_scanner.c" yy892: YYDEBUG(892, *YYCURSOR); yych = *++YYCURSOR; @@ -8593,11 +8559,11 @@ yy893: } YYDEBUG(894, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1431 "Zend/zend_language_scanner.l" +#line 1425 "Zend/zend_language_scanner.l" { return T_ELSEIF; } -#line 8601 "Zend/zend_language_scanner.c" +#line 8567 "Zend/zend_language_scanner.c" yy895: YYDEBUG(895, *YYCURSOR); yych = *++YYCURSOR; @@ -8611,11 +8577,11 @@ yy896: } YYDEBUG(897, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1515 "Zend/zend_language_scanner.l" +#line 1509 "Zend/zend_language_scanner.l" { return T_ECHO; } -#line 8619 "Zend/zend_language_scanner.c" +#line 8585 "Zend/zend_language_scanner.c" } /* *********************************** */ yyc_ST_LOOKING_FOR_PROPERTY: @@ -8690,9 +8656,9 @@ yy900: ++YYCURSOR; YYDEBUG(901, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2654 "Zend/zend_language_scanner.l" +#line 2620 "Zend/zend_language_scanner.l" { return 0; } -#line 8696 "Zend/zend_language_scanner.c" +#line 8662 "Zend/zend_language_scanner.c" yy902: YYDEBUG(902, *YYCURSOR); ++YYCURSOR; @@ -8701,7 +8667,7 @@ yy902: yy903: YYDEBUG(903, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1544 "Zend/zend_language_scanner.l" +#line 1538 "Zend/zend_language_scanner.l" { Z_STRVAL_P(zendlval) = yytext; /* no copying - intentional */ Z_STRLEN_P(zendlval) = yyleng; @@ -8709,7 +8675,7 @@ yy903: HANDLE_NEWLINES(yytext, yyleng); return T_WHITESPACE; } -#line 8713 "Zend/zend_language_scanner.c" +#line 8679 "Zend/zend_language_scanner.c" yy904: YYDEBUG(904, *YYCURSOR); ++YYCURSOR; @@ -8717,13 +8683,13 @@ yy904: yy905: YYDEBUG(905, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1567 "Zend/zend_language_scanner.l" +#line 1561 "Zend/zend_language_scanner.l" { yyless(0); yy_pop_state(TSRMLS_C); goto restart; } -#line 8727 "Zend/zend_language_scanner.c" +#line 8693 "Zend/zend_language_scanner.c" yy906: YYDEBUG(906, *YYCURSOR); ++YYCURSOR; @@ -8732,18 +8698,18 @@ yy906: yy907: YYDEBUG(907, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1556 "Zend/zend_language_scanner.l" +#line 1550 "Zend/zend_language_scanner.l" { yy_pop_state(TSRMLS_C); - if (!zend_copy_scanner_string(zendlval, yytext, yyleng, UG(unicode)?IS_UNICODE:IS_STRING, SCNG(output_conv) TSRMLS_CC)) { + if (!zend_copy_scanner_string(zendlval, yytext, yyleng, IS_UNICODE, SCNG(output_conv) TSRMLS_CC)) { return 0; } - if (UG(unicode) && !zend_check_and_normalize_identifier(zendlval)) { + if (!zend_check_and_normalize_identifier(zendlval)) { return 0; } return T_STRING; } -#line 8747 "Zend/zend_language_scanner.c" +#line 8713 "Zend/zend_language_scanner.c" yy908: YYDEBUG(908, *YYCURSOR); yych = *++YYCURSOR; @@ -8764,11 +8730,11 @@ yy911: ++YYCURSOR; YYDEBUG(912, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1552 "Zend/zend_language_scanner.l" +#line 1546 "Zend/zend_language_scanner.l" { return T_OBJECT_OPERATOR; } -#line 8772 "Zend/zend_language_scanner.c" +#line 8738 "Zend/zend_language_scanner.c" yy913: YYDEBUG(913, *YYCURSOR); ++YYCURSOR; @@ -8841,9 +8807,9 @@ yy917: ++YYCURSOR; YYDEBUG(918, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2654 "Zend/zend_language_scanner.l" +#line 2620 "Zend/zend_language_scanner.l" { return 0; } -#line 8847 "Zend/zend_language_scanner.c" +#line 8813 "Zend/zend_language_scanner.c" yy919: YYDEBUG(919, *YYCURSOR); ++YYCURSOR; @@ -8852,32 +8818,32 @@ yy919: yy920: YYDEBUG(920, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1843 "Zend/zend_language_scanner.l" +#line 1837 "Zend/zend_language_scanner.l" { - if (!zend_copy_scanner_string(zendlval, yytext, yyleng, UG(unicode)?IS_UNICODE:IS_STRING, SCNG(output_conv) TSRMLS_CC)) { + if (!zend_copy_scanner_string(zendlval, yytext, yyleng, IS_UNICODE, SCNG(output_conv) TSRMLS_CC)) { return 0; } - if (UG(unicode) && !zend_check_and_normalize_identifier(zendlval)) { + if (!zend_check_and_normalize_identifier(zendlval)) { return 0; } yy_pop_state(TSRMLS_C); yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); return T_STRING_VARNAME; } -#line 8868 "Zend/zend_language_scanner.c" +#line 8834 "Zend/zend_language_scanner.c" yy921: YYDEBUG(921, *YYCURSOR); ++YYCURSOR; YYDEBUG(922, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1856 "Zend/zend_language_scanner.l" +#line 1850 "Zend/zend_language_scanner.l" { yyless(0); yy_pop_state(TSRMLS_C); yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); goto restart; } -#line 8881 "Zend/zend_language_scanner.c" +#line 8847 "Zend/zend_language_scanner.c" yy923: YYDEBUG(923, *YYCURSOR); ++YYCURSOR; @@ -8943,9 +8909,9 @@ yy927: goto yy930; YYDEBUG(928, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2654 "Zend/zend_language_scanner.l" +#line 2620 "Zend/zend_language_scanner.l" { return 0; } -#line 8949 "Zend/zend_language_scanner.c" +#line 8915 "Zend/zend_language_scanner.c" yy929: YYDEBUG(929, *YYCURSOR); ++YYCURSOR; @@ -9038,7 +9004,7 @@ yy938: ++YYCURSOR; YYDEBUG(939, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2601 "Zend/zend_language_scanner.l" +#line 2567 "Zend/zend_language_scanner.l" { char *end = yytext + yyleng - 1; @@ -9079,7 +9045,7 @@ yy938: yymore(); } } -#line 9083 "Zend/zend_language_scanner.c" +#line 9049 "Zend/zend_language_scanner.c" yy940: YYDEBUG(940, *YYCURSOR); ++YYCURSOR; @@ -9190,9 +9156,9 @@ yy946: goto yy961; YYDEBUG(947, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2654 "Zend/zend_language_scanner.l" +#line 2620 "Zend/zend_language_scanner.l" { return 0; } -#line 9196 "Zend/zend_language_scanner.c" +#line 9162 "Zend/zend_language_scanner.c" yy948: YYDEBUG(948, *YYCURSOR); ++YYCURSOR; @@ -9200,11 +9166,11 @@ yy948: yy949: YYDEBUG(949, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2246 "Zend/zend_language_scanner.l" +#line 2222 "Zend/zend_language_scanner.l" { yymore(); } -#line 9208 "Zend/zend_language_scanner.c" +#line 9174 "Zend/zend_language_scanner.c" yy950: YYDEBUG(950, *YYCURSOR); yych = *++YYCURSOR; @@ -9241,7 +9207,7 @@ yy952: yy954: YYDEBUG(954, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2250 "Zend/zend_language_scanner.l" +#line 2226 "Zend/zend_language_scanner.l" { switch (yytext[yyleng-1]) { case '?': case '%': case '>': @@ -9259,7 +9225,7 @@ yy954: return T_COMMENT; } } -#line 9263 "Zend/zend_language_scanner.c" +#line 9229 "Zend/zend_language_scanner.c" yy955: YYDEBUG(955, *YYCURSOR); yych = *++YYCURSOR; @@ -9272,7 +9238,7 @@ yy956: ++YYCURSOR; YYDEBUG(958, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2268 "Zend/zend_language_scanner.l" +#line 2244 "Zend/zend_language_scanner.l" { Z_STRVAL_P(zendlval) = yytext; /* no copying - intentional */ Z_STRLEN_P(zendlval) = yyleng; @@ -9281,7 +9247,7 @@ yy956: CG(zend_lineno)++; return T_COMMENT; } -#line 9285 "Zend/zend_language_scanner.c" +#line 9251 "Zend/zend_language_scanner.c" yy959: YYDEBUG(959, *YYCURSOR); yych = *++YYCURSOR; @@ -9315,7 +9281,7 @@ yy962: ++YYCURSOR; YYDEBUG(963, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2277 "Zend/zend_language_scanner.l" +#line 2253 "Zend/zend_language_scanner.l" { if (CG(asp_tags) || yytext[yyleng-2] != '%') { /* asp comment? */ Z_STRVAL_P(zendlval) = yytext; /* no copying - intentional */ @@ -9328,7 +9294,7 @@ yy962: yymore(); } } -#line 9332 "Zend/zend_language_scanner.c" +#line 9298 "Zend/zend_language_scanner.c" } /* *********************************** */ yyc_ST_VAR_OFFSET: @@ -9420,9 +9386,9 @@ yy966: ++YYCURSOR; YYDEBUG(967, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2654 "Zend/zend_language_scanner.l" +#line 2620 "Zend/zend_language_scanner.l" { return 0; } -#line 9426 "Zend/zend_language_scanner.c" +#line 9392 "Zend/zend_language_scanner.c" yy968: YYDEBUG(968, *YYCURSOR); yyaccept = 0; @@ -9437,7 +9403,7 @@ yy968: yy969: YYDEBUG(969, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1906 "Zend/zend_language_scanner.l" +#line 1900 "Zend/zend_language_scanner.l" { /* Offset could be treated as a long */ if (yyleng < MAX_LENGTH_OF_LONG - 1 || (yyleng == MAX_LENGTH_OF_LONG - 1 && strcmp(yytext, long_min_digits) < 0)) { Z_LVAL_P(zendlval) = strtol(yytext, NULL, 10); @@ -9449,7 +9415,7 @@ yy969: } return T_NUM_STRING; } -#line 9453 "Zend/zend_language_scanner.c" +#line 9419 "Zend/zend_language_scanner.c" yy970: YYDEBUG(970, *YYCURSOR); yych = *++YYCURSOR; @@ -9469,23 +9435,23 @@ yy971: yy972: YYDEBUG(972, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2210 "Zend/zend_language_scanner.l" +#line 2186 "Zend/zend_language_scanner.l" { /* Only '[' can be valid, but returning other tokens will allow a more explicit parse error */ return yytext[0]; } -#line 9478 "Zend/zend_language_scanner.c" +#line 9444 "Zend/zend_language_scanner.c" yy973: YYDEBUG(973, *YYCURSOR); ++YYCURSOR; YYDEBUG(974, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2205 "Zend/zend_language_scanner.l" +#line 2181 "Zend/zend_language_scanner.l" { yy_pop_state(TSRMLS_C); return ']'; } -#line 9489 "Zend/zend_language_scanner.c" +#line 9455 "Zend/zend_language_scanner.c" yy975: YYDEBUG(975, *YYCURSOR); yych = *++YYCURSOR; @@ -9495,7 +9461,7 @@ yy976: ++YYCURSOR; YYDEBUG(977, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2215 "Zend/zend_language_scanner.l" +#line 2191 "Zend/zend_language_scanner.l" { /* Invalid rule to return a more explicit parse error with proper line number */ yyless(0); @@ -9503,7 +9469,7 @@ yy976: ZVAL_EMPTY_TEXT(zendlval); /* Empty since it won't be used */ return T_ENCAPSED_AND_WHITESPACE; } -#line 9507 "Zend/zend_language_scanner.c" +#line 9473 "Zend/zend_language_scanner.c" yy978: YYDEBUG(978, *YYCURSOR); ++YYCURSOR; @@ -9512,25 +9478,25 @@ yy978: yy979: YYDEBUG(979, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2233 "Zend/zend_language_scanner.l" +#line 2209 "Zend/zend_language_scanner.l" { if (!zend_copy_scanner_string(zendlval, yytext, yyleng, CG(literal_type), SCNG(output_conv) TSRMLS_CC)) { return 0; } return T_STRING; } -#line 9523 "Zend/zend_language_scanner.c" +#line 9489 "Zend/zend_language_scanner.c" yy980: YYDEBUG(980, *YYCURSOR); ++YYCURSOR; YYDEBUG(981, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2656 "Zend/zend_language_scanner.l" +#line 2622 "Zend/zend_language_scanner.l" { zend_error(E_COMPILE_WARNING,"Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE); goto restart; } -#line 9534 "Zend/zend_language_scanner.c" +#line 9500 "Zend/zend_language_scanner.c" yy982: YYDEBUG(982, *YYCURSOR); ++YYCURSOR; @@ -9566,17 +9532,17 @@ yy984: yy986: YYDEBUG(986, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2195 "Zend/zend_language_scanner.l" +#line 2171 "Zend/zend_language_scanner.l" { - if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), UG(unicode)?IS_UNICODE:IS_STRING, SCNG(output_conv) TSRMLS_CC)) { + if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), IS_UNICODE, SCNG(output_conv) TSRMLS_CC)) { return 0; } - if (UG(unicode) && !zend_check_and_normalize_identifier(zendlval)) { + if (!zend_check_and_normalize_identifier(zendlval)) { return 0; } return T_VARIABLE; } -#line 9580 "Zend/zend_language_scanner.c" +#line 9546 "Zend/zend_language_scanner.c" yy987: YYDEBUG(987, *YYCURSOR); ++YYCURSOR; @@ -9608,14 +9574,14 @@ yy991: yy993: YYDEBUG(993, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1918 "Zend/zend_language_scanner.l" +#line 1912 "Zend/zend_language_scanner.l" { /* Offset must be treated as a string */ if (!zend_copy_scanner_string(zendlval, yytext, yyleng, CG(literal_type), SCNG(output_conv) TSRMLS_CC)) { return 0; } return T_NUM_STRING; } -#line 9619 "Zend/zend_language_scanner.c" +#line 9585 "Zend/zend_language_scanner.c" yy994: YYDEBUG(994, *YYCURSOR); ++YYCURSOR; @@ -9628,6 +9594,6 @@ yy994: goto yy993; } } -#line 2661 "Zend/zend_language_scanner.l" +#line 2627 "Zend/zend_language_scanner.l" } diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index 02d197c3d9..7020773a9d 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -606,12 +606,6 @@ int zend_unicode_yyinput(zend_file_handle *file_handle, char *buf, size_t len TS n = zend_stream_read(file_handle, buf, len TSRMLS_CC); } #endif - - /* Don't make any conversions if unicode=off */ - if (!UG(unicode)) { - return n; - } - /* Autodetect encoding */ if (!SCNG(encoding_checked)) { int32_t signatureLength; @@ -867,7 +861,7 @@ zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC) tmp = *source_string; zval_copy_ctor(&tmp); if (Z_TYPE(tmp) != IS_STRING && Z_TYPE(tmp) != IS_UNICODE) { - convert_to_text(&tmp); + convert_to_unicode(&tmp); } source_string = &tmp; @@ -1555,10 +1549,10 @@ NOWDOC_CHARS ([^\n\r]|{NEWLINE}+([^a-zA-Z_\x7f-\xff\n\r]|({LABEL}([^a-zA- <ST_LOOKING_FOR_PROPERTY>{LABEL} { yy_pop_state(TSRMLS_C); - if (!zend_copy_scanner_string(zendlval, yytext, yyleng, UG(unicode)?IS_UNICODE:IS_STRING, SCNG(output_conv) TSRMLS_CC)) { + if (!zend_copy_scanner_string(zendlval, yytext, yyleng, IS_UNICODE, SCNG(output_conv) TSRMLS_CC)) { return 0; } - if (UG(unicode) && !zend_check_and_normalize_identifier(zendlval)) { + if (!zend_check_and_normalize_identifier(zendlval)) { return 0; } return T_STRING; @@ -1841,10 +1835,10 @@ NOWDOC_CHARS ([^\n\r]|{NEWLINE}+([^a-zA-Z_\x7f-\xff\n\r]|({LABEL}([^a-zA- <ST_LOOKING_FOR_VARNAME>{LABEL} { - if (!zend_copy_scanner_string(zendlval, yytext, yyleng, UG(unicode)?IS_UNICODE:IS_STRING, SCNG(output_conv) TSRMLS_CC)) { + if (!zend_copy_scanner_string(zendlval, yytext, yyleng, IS_UNICODE, SCNG(output_conv) TSRMLS_CC)) { return 0; } - if (UG(unicode) && !zend_check_and_normalize_identifier(zendlval)) { + if (!zend_check_and_normalize_identifier(zendlval)) { return 0; } yy_pop_state(TSRMLS_C); @@ -1962,48 +1956,30 @@ NOWDOC_CHARS ([^\n\r]|{NEWLINE}+([^a-zA-Z_\x7f-\xff\n\r]|({LABEL}([^a-zA- zstr class_name = CG(active_class_entry) ? CG(active_class_entry)->name : NULL_ZSTR; zstr func_name = CG(active_op_array)? CG(active_op_array)->function_name : NULL_ZSTR; size_t len = 0; + size_t len1; - if (UG(unicode)) { - size_t len1; - - if (class_name.u) { - len += len1 = u_strlen(class_name.u); - len += 2; - } - if (func_name.u) { - len += u_strlen(func_name.u); - } else { - func_name.u = EMPTY_STR; - } - Z_USTRLEN_P(zendlval) = len; - Z_USTRVAL_P(zendlval) = eumalloc(len+1); - 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), func_name.u); - Z_TYPE_P(zendlval) = IS_UNICODE; + if (class_name.u) { + len += len1 = u_strlen(class_name.u); + len += 2; + } + if (func_name.u) { + len += u_strlen(func_name.u); } else { - if (class_name.s) { - len += strlen(class_name.s) + 2; - } - 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.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; + func_name.u = EMPTY_STR; + } + Z_USTRLEN_P(zendlval) = len; + Z_USTRVAL_P(zendlval) = eumalloc(len+1); + 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), func_name.u); + Z_TYPE_P(zendlval) = IS_UNICODE; + return T_METHOD_C; } @@ -2168,10 +2144,10 @@ inline_char_handler: yyless(yyleng - 3); yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); - if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), UG(unicode)?IS_UNICODE:IS_STRING, SCNG(output_conv) TSRMLS_CC)) { + if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), IS_UNICODE, SCNG(output_conv) TSRMLS_CC)) { return 0; } - if (UG(unicode) && !zend_check_and_normalize_identifier(zendlval)) { + if (!zend_check_and_normalize_identifier(zendlval)) { return 0; } return T_VARIABLE; @@ -2183,20 +2159,20 @@ inline_char_handler: yyless(yyleng - 1); yy_push_state(ST_VAR_OFFSET TSRMLS_CC); - if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), UG(unicode)?IS_UNICODE:IS_STRING, SCNG(output_conv) TSRMLS_CC)) { + if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), IS_UNICODE, SCNG(output_conv) TSRMLS_CC)) { return 0; } - if (UG(unicode) && !zend_check_and_normalize_identifier(zendlval)) { + if (!zend_check_and_normalize_identifier(zendlval)) { return 0; } return T_VARIABLE; } <ST_IN_SCRIPTING,ST_DOUBLE_QUOTES,ST_HEREDOC,ST_BACKQUOTE,ST_VAR_OFFSET>"$"{LABEL} { - if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), UG(unicode)?IS_UNICODE:IS_STRING, SCNG(output_conv) TSRMLS_CC)) { + if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), IS_UNICODE, SCNG(output_conv) TSRMLS_CC)) { return 0; } - if (UG(unicode) && !zend_check_and_normalize_identifier(zendlval)) { + if (!zend_check_and_normalize_identifier(zendlval)) { return 0; } return T_VARIABLE; @@ -2221,10 +2197,10 @@ inline_char_handler: } <ST_IN_SCRIPTING>{LABEL} { - if (!zend_copy_scanner_string(zendlval, yytext, yyleng, UG(unicode)?IS_UNICODE:IS_STRING, SCNG(output_conv) TSRMLS_CC)) { + if (!zend_copy_scanner_string(zendlval, yytext, yyleng, IS_UNICODE, SCNG(output_conv) TSRMLS_CC)) { return 0; } - if (UG(unicode) && !zend_check_and_normalize_identifier(zendlval)) { + if (!zend_check_and_normalize_identifier(zendlval)) { return 0; } return T_STRING; @@ -2312,7 +2288,7 @@ inline_char_handler: zval temp; HANDLE_NEWLINES(yytext, yyleng); - if (!zend_copy_scanner_string(&temp, yytext, yyleng, UG(unicode)?IS_UNICODE:IS_STRING, SCNG(output_conv) TSRMLS_CC)) { + if (!zend_copy_scanner_string(&temp, yytext, yyleng, IS_UNICODE, SCNG(output_conv) TSRMLS_CC)) { return 0; } CG(doc_comment) = temp.value.uni.val; @@ -2357,12 +2333,7 @@ inline_char_handler: /* ("{"*|"$"*) handles { or $ at the end of a string (or the entire contents) */ <ST_IN_SCRIPTING>(["]{DOUBLE_QUOTES_CHARS}*("{"*|"$"*)["]) { - if (UG(unicode)) { - return zend_scan_unicode_escape_string(zendlval, yytext+1, yyleng-2, 0x22 /*'"'*/, T_CONSTANT_ENCAPSED_STRING TSRMLS_CC); - } else { - zend_scan_binary_escape_string(zendlval, yytext+1, yyleng-2, '"' TSRMLS_CC); - return T_CONSTANT_ENCAPSED_STRING; - } + return zend_scan_unicode_escape_string(zendlval, yytext+1, yyleng-2, 0x22 /*'"'*/, T_CONSTANT_ENCAPSED_STRING TSRMLS_CC); } @@ -2373,12 +2344,7 @@ inline_char_handler: <ST_IN_SCRIPTING>([']([^'\\]|("\\"{ANY_CHAR}))*[']) { - if (UG(unicode)) { - return zend_scan_unicode_single_string(zendlval TSRMLS_CC); - } else { - zend_scan_binary_single_string(zendlval, yytext+1, yyleng-2 TSRMLS_CC); - return T_CONSTANT_ENCAPSED_STRING; - } + return zend_scan_unicode_single_string(zendlval TSRMLS_CC); } diff --git a/Zend/zend_language_scanner_defs.h b/Zend/zend_language_scanner_defs.h index 5c7f7907d5..0abb9a83d4 100644 --- a/Zend/zend_language_scanner_defs.h +++ b/Zend/zend_language_scanner_defs.h @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Thu Mar 26 15:38:15 2009 */ +/* Generated by re2c 0.13.5 on Thu Mar 26 16:22:31 2009 */ #line 3 "Zend/zend_language_scanner_defs.h" enum YYCONDTYPE { diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 6a093961f8..2fe8d66a52 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -281,10 +281,7 @@ ZEND_API int zend_check_property_access(zend_object *zobj, zend_uchar utype, zst 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(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(prop_info_name.u+1, property_info->name.u+1)) { + } else if (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; } @@ -307,14 +304,14 @@ static int zend_get_property_guard(zend_object *zobj, zend_property_info *proper if (!zobj->guards) { ALLOC_HASHTABLE(zobj->guards); zend_u_hash_init(zobj->guards, 0, NULL, NULL, 0, UG(unicode)); - } else if (zend_u_hash_quick_find(zobj->guards, UG(unicode)?IS_UNICODE:IS_STRING, property_info->name, property_info->name_length+1, property_info->h, (void **) pguard) == SUCCESS) { + } else if (zend_u_hash_quick_find(zobj->guards, IS_UNICODE, property_info->name, property_info->name_length+1, property_info->h, (void **) pguard) == SUCCESS) { return SUCCESS; } stub.in_get = 0; stub.in_set = 0; stub.in_unset = 0; stub.in_isset = 0; - return zend_u_hash_quick_add(zobj->guards, UG(unicode)?IS_UNICODE:IS_STRING, property_info->name, property_info->name_length+1, property_info->h, (void**)&stub, sizeof(stub), (void**) pguard); + return zend_u_hash_quick_add(zobj->guards, IS_UNICODE, property_info->name, property_info->name_length+1, property_info->h, (void**)&stub, sizeof(stub), (void**) pguard); } /* }}} */ @@ -330,12 +327,12 @@ zval *zend_std_read_property(zval *object, zval *member, int type TSRMLS_DC) /* silent = (type == BP_VAR_IS); zobj = Z_OBJ_P(object); - if (Z_TYPE_P(member) != IS_UNICODE && (UG(unicode) || Z_TYPE_P(member) != IS_STRING)) { + if (Z_TYPE_P(member) != IS_UNICODE) { ALLOC_ZVAL(tmp_member); *tmp_member = *member; INIT_PZVAL(tmp_member); zval_copy_ctor(tmp_member); - convert_to_text(tmp_member); + convert_to_unicode(tmp_member); member = tmp_member; } @@ -404,12 +401,12 @@ static void zend_std_write_property(zval *object, zval *member, zval *value TSRM zobj = Z_OBJ_P(object); - if (Z_TYPE_P(member) != IS_UNICODE && (UG(unicode) || Z_TYPE_P(member) != IS_STRING)) { + if (Z_TYPE_P(member) != IS_UNICODE) { ALLOC_ZVAL(tmp_member); *tmp_member = *member; INIT_PZVAL(tmp_member); zval_copy_ctor(tmp_member); - convert_to_text(tmp_member); + convert_to_unicode(tmp_member); member = tmp_member; } @@ -568,10 +565,10 @@ static zval **zend_std_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC zobj = Z_OBJ_P(object); - if (Z_TYPE_P(member) != IS_UNICODE && (UG(unicode) || Z_TYPE_P(member) != IS_STRING)) { + if (Z_TYPE_P(member) != IS_UNICODE) { tmp_member = *member; zval_copy_ctor(&tmp_member); - convert_to_text(&tmp_member); + convert_to_unicode(&tmp_member); member = &tmp_member; } @@ -614,12 +611,12 @@ static void zend_std_unset_property(zval *object, zval *member TSRMLS_DC) /* {{{ zobj = Z_OBJ_P(object); - if (Z_TYPE_P(member) != IS_UNICODE && (UG(unicode) || Z_TYPE_P(member) != IS_STRING)) { + if (Z_TYPE_P(member) != IS_UNICODE) { ALLOC_ZVAL(tmp_member); *tmp_member = *member; INIT_PZVAL(tmp_member); zval_copy_ctor(tmp_member); - convert_to_text(tmp_member); + convert_to_unicode(tmp_member); member = tmp_member; } @@ -731,7 +728,7 @@ static inline zend_function *zend_check_private_int(zend_function *fbc, zend_cla ce = ce->parent; while (ce) { if (ce == EG(scope)) { - if (zend_u_hash_find(&ce->function_table, UG(unicode)?IS_UNICODE:IS_STRING, function_name_strval, function_name_strlen+1, (void **) &fbc)==SUCCESS + if (zend_u_hash_find(&ce->function_table, IS_UNICODE, function_name_strval, function_name_strlen+1, (void **) &fbc)==SUCCESS && fbc->op_array.fn_flags & ZEND_ACC_PRIVATE && fbc->common.scope == EG(scope)) { return fbc; @@ -797,11 +794,7 @@ static inline union _zend_function *zend_get_user_call_function(zend_object *zob call_user_call->num_args = 0; call_user_call->scope = zobj->ce; call_user_call->fn_flags = ZEND_ACC_CALL_VIA_HANDLER; - if (UG(unicode)) { - call_user_call->function_name.u = eustrndup(method_name.u, method_len); - } else { - call_user_call->function_name.s = estrndup(method_name.s, method_len); - } + call_user_call->function_name.u = eustrndup(method_name.u, method_len); call_user_call->pass_rest_by_reference = 0; call_user_call->return_reference = ZEND_RETURN_VALUE; @@ -818,7 +811,7 @@ static union _zend_function *zend_std_get_method(zval **object_ptr, zstr method_ zval *object = *object_ptr; /* FIXME: type is default */ - zend_uchar type = UG(unicode)?IS_UNICODE:IS_STRING; + zend_uchar type = IS_UNICODE; /* Create a zend_copy_str_tolower(dest, src, src_length); */ lc_method_name = zend_u_str_case_fold(type, method_name, method_len, 1, &lc_method_name_len); @@ -966,11 +959,7 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_uc call_user_call->num_args = 0; call_user_call->scope = ce; call_user_call->fn_flags = ZEND_ACC_CALL_VIA_HANDLER; - if (UG(unicode)) { - call_user_call->function_name.u = eustrndup(function_name_strval.u, function_name_strlen); - } else { - call_user_call->function_name.s = estrndup(function_name_strval.s, function_name_strlen); - } + call_user_call->function_name.u = eustrndup(function_name_strval.u, function_name_strlen); call_user_call->pass_rest_by_reference = 0; call_user_call->return_reference = ZEND_RETURN_VALUE; @@ -984,13 +973,7 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_uc callstatic_user_call->num_args = 0; callstatic_user_call->scope = ce; callstatic_user_call->fn_flags = ZEND_ACC_STATIC | ZEND_ACC_PUBLIC | ZEND_ACC_CALL_VIA_HANDLER; - - if (UG(unicode)) { - callstatic_user_call->function_name.u = eustrndup(function_name_strval.u, function_name_strlen); - } else { - callstatic_user_call->function_name.s = estrndup(function_name_strval.s, function_name_strlen); - } - + callstatic_user_call->function_name.u = eustrndup(function_name_strval.u, function_name_strlen); callstatic_user_call->pass_rest_by_reference = 0; callstatic_user_call->return_reference = ZEND_RETURN_VALUE; @@ -1043,7 +1026,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_u_get_hash_value(UG(unicode)?IS_UNICODE:IS_STRING, std_property_info.name, std_property_info.name_length+1); + std_property_info.h = zend_u_get_hash_value(IS_UNICODE, std_property_info.name, std_property_info.name_length+1); std_property_info.ce = ce; property_info = &std_property_info; } @@ -1061,7 +1044,7 @@ ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, zend_uchar ty zend_update_class_constants(tmp_ce TSRMLS_CC); - zend_u_hash_quick_find(CE_STATIC_MEMBERS(tmp_ce), UG(unicode)?IS_UNICODE:IS_STRING, property_info->name, property_info->name_length+1, property_info->h, (void **) &retval); + zend_u_hash_quick_find(CE_STATIC_MEMBERS(tmp_ce), IS_UNICODE, property_info->name, property_info->name_length+1, property_info->h, (void **) &retval); if (!retval) { if (silent) { @@ -1145,12 +1128,12 @@ static int zend_std_has_property(zval *object, zval *member, int has_set_exists zobj = Z_OBJ_P(object); - if (Z_TYPE_P(member) != IS_UNICODE && (UG(unicode) || Z_TYPE_P(member) != IS_STRING)) { + if (Z_TYPE_P(member) != IS_UNICODE) { ALLOC_ZVAL(tmp_member); *tmp_member = *member; INIT_PZVAL(tmp_member); zval_copy_ctor(tmp_member); - convert_to_text(tmp_member); + convert_to_unicode(tmp_member); member = tmp_member; } @@ -1243,11 +1226,7 @@ int zend_std_object_get_class_name(const zval *object, zstr *class_name, zend_ui } *class_name_len = ce->name_length; - if (UG(unicode)) { - class_name->u = eustrndup(ce->name.u, ce->name_length); - } else { - class_name->s = estrndup(ce->name.s, ce->name_length); - } + class_name->u = eustrndup(ce->name.u, ce->name_length); return SUCCESS; } /* }}} */ @@ -1276,7 +1255,7 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty zend_error(E_ERROR, "Method %v::__toString() must not throw an exception", ce->name); return FAILURE; } - if (Z_TYPE_P(retval) == (UG(unicode)?IS_UNICODE:IS_STRING)) { + if (Z_TYPE_P(retval) == IS_UNICODE) { INIT_PZVAL(writeobj); if (readobj == writeobj) { zval_dtor(readobj); @@ -1340,7 +1319,7 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty int zend_std_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval **zobj_ptr TSRMLS_DC) /* {{{ */ { zstr key; - zend_uchar utype = UG(unicode)?IS_UNICODE:IS_STRING; + zend_uchar utype = IS_UNICODE; zend_class_entry *ce; if (Z_TYPE_P(obj) != IS_OBJECT) { diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index c09f5cbf7d..c8987b7433 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -1769,14 +1769,10 @@ ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{ if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) { result_type = IS_STRING; - } else if (Z_TYPE_P(op1) == IS_UNICODE || Z_TYPE_P(op2) == IS_UNICODE || UG(unicode)) { + } else { zend_make_unicode_zval(op1, &op1_copy, &use_copy1); zend_make_unicode_zval(op2, &op2_copy, &use_copy2); result_type = IS_UNICODE; - } else { - result_type = IS_STRING; - zend_make_string_zval(op1, &op1_copy, &use_copy1); - zend_make_string_zval(op2, &op2_copy, &use_copy2); } if (use_copy1) { @@ -1825,13 +1821,8 @@ ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_D zval op1_copy, op2_copy; int use_copy1, use_copy2; - if (UG(unicode)) { - zend_make_unicode_zval(op1, &op1_copy, &use_copy1); - zend_make_unicode_zval(op2, &op2_copy, &use_copy2); - } else { - zend_make_string_zval(op1, &op1_copy, &use_copy1); - zend_make_string_zval(op2, &op2_copy, &use_copy2); - } + zend_make_unicode_zval(op1, &op1_copy, &use_copy1); + zend_make_unicode_zval(op2, &op2_copy, &use_copy2); if (use_copy1) { op1 = &op1_copy; @@ -1840,11 +1831,7 @@ ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_D op2 = &op2_copy; } - if (UG(unicode)) { - Z_LVAL_P(result) = zend_u_binary_zval_strcmp(op1, op2); - } else { - Z_LVAL_P(result) = zend_binary_zval_strcmp(op1, op2); - } + Z_LVAL_P(result) = zend_u_binary_zval_strcmp(op1, op2); Z_TYPE_P(result) = IS_LONG; if (use_copy1) { @@ -1862,13 +1849,8 @@ ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 T zval op1_copy, op2_copy; int use_copy1, use_copy2; - if (UG(unicode)) { - zend_make_unicode_zval(op1, &op1_copy, &use_copy1); - zend_make_unicode_zval(op2, &op2_copy, &use_copy2); - } else { - zend_make_string_zval(op1, &op1_copy, &use_copy1); - zend_make_string_zval(op2, &op2_copy, &use_copy2); - } + zend_make_unicode_zval(op1, &op1_copy, &use_copy1); + zend_make_unicode_zval(op2, &op2_copy, &use_copy2); if (use_copy1) { op1 = &op1_copy; @@ -1877,11 +1859,7 @@ ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 T op2 = &op2_copy; } - if (UG(unicode)) { - Z_LVAL_P(result) = ucol_strcoll(UG(default_collator)->coll, Z_USTRVAL_P(op1), Z_USTRLEN_P(op1), Z_USTRVAL_P(op2), Z_USTRLEN_P(op2)); - } else { - Z_LVAL_P(result) = strcoll(Z_STRVAL_P(op1), Z_STRVAL_P(op2)); - } + Z_LVAL_P(result) = ucol_strcoll(UG(default_collator)->coll, Z_USTRVAL_P(op1), Z_USTRLEN_P(op1), Z_USTRVAL_P(op2), Z_USTRLEN_P(op2)); Z_TYPE_P(result) = IS_LONG; if (use_copy1) { diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 0457e2ac37..98980d0995 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -323,7 +323,7 @@ ZEND_API int add_string_to_string(zval *result, const zval *op1, const zval *op2 #define convert_to_string_with_converter(op, conv) _convert_to_string_with_converter((op), (conv) TSRMLS_CC ZEND_FILE_LINE_CC) #define convert_to_unicode(op) _convert_to_unicode((op) TSRMLS_CC ZEND_FILE_LINE_CC) #define convert_to_unicode_with_converter(op, conv) _convert_to_unicode_with_converter((op), (conv) TSRMLS_CC ZEND_FILE_LINE_CC) -#define convert_to_text(op) (UG(unicode)?convert_to_unicode(op):convert_to_string(op)) +#define convert_to_text(op) convert_to_unicode(op) ZEND_API double zend_string_to_double(const char *number, zend_uint length); @@ -424,7 +424,7 @@ END_EXTERN_C() #define convert_to_array_ex(ppzv) convert_to_ex_master(ppzv, array, ARRAY) #define convert_to_object_ex(ppzv) convert_to_ex_master(ppzv, object, OBJECT) #define convert_to_null_ex(ppzv) convert_to_ex_master(ppzv, null, NULL) -#define convert_to_text_ex(ppzv) if (UG(unicode)) {convert_to_unicode_ex(ppzv);} else {convert_to_string_ex(ppzv);} +#define convert_to_text_ex(ppzv) convert_to_unicode_ex(ppzv); #define convert_to_string_with_converter_ex(ppzv, conv) \ if (Z_TYPE_PP(ppzv) != IS_STRING) { \ diff --git a/Zend/zend_unicode.h b/Zend/zend_unicode.h index 0ffdd46e74..608b111a1a 100644 --- a/Zend/zend_unicode.h +++ b/Zend/zend_unicode.h @@ -134,17 +134,17 @@ 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((str).u):strlen((str).s)) -#define USTR_VAL(str) (UG(unicode)?(str).u:(str).s) +#define USTR_LEN(str) u_strlen((str).u) +#define USTR_VAL(str) (str).u #define USTR_BYTES(__type, __length) \ ((__type == IS_UNICODE)?UBYTES(__length):__length) #define TEXT_BYTES(__chars_len) \ - (UG(unicode) ? UBYTES(__chars_len) : __chars_len) + UBYTES(__chars_len) #define TEXT_CHARS(__bytes_len) \ - (UG(unicode) ? (__bytes_len / sizeof(UChar)) : __bytes_len) + (__bytes_len / sizeof(UChar)) #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) diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c index f5ef6f77a4..10f96c2ca1 100644 --- a/Zend/zend_variables.c +++ b/Zend/zend_variables.c @@ -30,9 +30,7 @@ ZEND_API void _zval_dtor_func(zval *zvalue ZEND_FILE_LINE_DC) /* {{{ */ { switch (Z_TYPE_P(zvalue) & IS_CONSTANT_TYPE_MASK) { case IS_CONSTANT: { - TSRMLS_FETCH(); - - if (UG(unicode)) goto dtor_unicode; + goto dtor_unicode; } case IS_STRING: CHECK_ZVAL_STRING_REL(zvalue); @@ -83,9 +81,7 @@ ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC) /* {{{ */ { switch (Z_TYPE_P(zvalue) & IS_CONSTANT_TYPE_MASK) { case IS_CONSTANT: { - TSRMLS_FETCH(); - - if (UG(unicode)) goto dtor_unicode; + goto dtor_unicode; } case IS_STRING: CHECK_ZVAL_STRING_REL(zvalue); @@ -132,9 +128,7 @@ ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC) /* {{{ */ case IS_NULL: break; case IS_CONSTANT: { - TSRMLS_FETCH(); - - if (UG(unicode)) goto copy_unicode; + goto copy_unicode; } case IS_STRING: CHECK_ZVAL_STRING_REL(zvalue); diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 7d674326ba..a8003d23fa 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -919,7 +919,7 @@ ZEND_VM_HANDLER(40, ZEND_ECHO, CONST|TMP|VAR|CV, ANY) zval_dtor(&z_conv); ucnv_close(script_enc_conv); } else if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get_method != NULL && - zend_std_cast_object_tostring(z, &z_copy, ZEND_STR_TYPE, ZEND_U_CONVERTER(UG(output_encoding_conv)) TSRMLS_CC) == SUCCESS) { + zend_std_cast_object_tostring(z, &z_copy, IS_UNICODE, ZEND_U_CONVERTER(UG(output_encoding_conv)) TSRMLS_CC) == SUCCESS) { zend_print_variable(&z_copy); zval_dtor(&z_copy); } else { @@ -954,7 +954,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, ANY, int type Z_TYPE_P(varname) != IS_UNICODE) { tmp_varname = *varname; zval_copy_ctor(&tmp_varname); - convert_to_text(&tmp_varname); + convert_to_unicode(&tmp_varname); varname = &tmp_varname; } @@ -1980,7 +1980,7 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV) int function_name_strlen; zend_free_op free_op1, free_op2; /* FIXME: type is default */ - zend_uchar type = UG(unicode)?IS_UNICODE:IS_STRING; + zend_uchar type = IS_UNICODE; zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); @@ -2642,7 +2642,7 @@ ZEND_VM_HANDLER(107, ZEND_CATCH, ANY, CV) *EX(CVs)[opline->op2.u.var] = EG(exception); } else { zend_compiled_variable *cv = &CV_DEF_OF(opline->op2.u.var); - zend_u_hash_quick_update(EG(active_symbol_table), ZEND_STR_TYPE, cv->name, cv->name_len+1, cv->hash_value, + zend_u_hash_quick_update(EG(active_symbol_table), IS_UNICODE, cv->name, cv->name_len+1, cv->hash_value, &EG(exception), sizeof(zval *), (void**)&EX(CVs)[opline->op2.u.var]); } EG(exception) = NULL; @@ -3179,7 +3179,7 @@ ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|VAR|CV, CONST|TMP|VAR|UNUS zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_u_hash_update(Z_ARRVAL_P(array_ptr), ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_u_hash_update(Z_ARRVAL_P(array_ptr), IS_UNICODE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -3297,7 +3297,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY) zval tmp_inc_filename; zend_bool failure_retval=0; - if (UG(unicode) && Z_LVAL(opline->op2.u.constant) == ZEND_EVAL) { + if (Z_LVAL(opline->op2.u.constant) == ZEND_EVAL) { if (Z_TYPE_P(inc_filename) != IS_UNICODE) { tmp_inc_filename = *inc_filename; zval_copy_ctor(&tmp_inc_filename); @@ -3450,7 +3450,7 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, ANY) zend_execute_data *ex = EX(prev_execute_data); zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.u.var); - if (zend_u_hash_quick_del(EG(active_symbol_table), ZEND_STR_TYPE, cv->name, cv->name_len+1, cv->hash_value) == SUCCESS) { + if (zend_u_hash_quick_del(EG(active_symbol_table), IS_UNICODE, cv->name, cv->name_len+1, cv->hash_value) == SUCCESS) { while (ex && ex->symbol_table == EG(active_symbol_table)) { int i; @@ -3458,7 +3458,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 == cv->hash_value && ex->op_array->vars[i].name_len == cv->name_len && - !memcmp(ex->op_array->vars[i].name.v, cv->name.v, USTR_BYTES(ZEND_STR_TYPE, cv->name_len))) { + !memcmp(ex->op_array->vars[i].name.v, cv->name.v, USTR_BYTES(IS_UNICODE, cv->name_len))) { ex->CVs[i] = NULL; break; } @@ -3480,7 +3480,7 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, ANY) if (Z_TYPE_P(varname) != IS_STRING && Z_TYPE_P(varname) != IS_UNICODE) { tmp = *varname; zval_copy_ctor(&tmp); - convert_to_text(&tmp); + convert_to_unicode(&tmp); varname = &tmp; } else if (OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) { Z_ADDREF_P(varname); @@ -3559,7 +3559,7 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV) int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { + if (ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int norm_len; @@ -3606,7 +3606,7 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV) break; } case IS_NULL: - zend_u_hash_del(ht, ZEND_STR_TYPE, EMPTY_ZSTR, sizeof("")); + zend_u_hash_del(ht, IS_UNICODE, EMPTY_ZSTR, sizeof("")); break; default: zend_error(E_WARNING, "Illegal offset type in unset"); @@ -4001,7 +4001,7 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, ANY) } else if (EG(active_symbol_table)) { zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.u.var); - if (zend_u_hash_quick_find(EG(active_symbol_table), ZEND_STR_TYPE, cv->name, cv->name_len+1, cv->hash_value, (void **) &value) == FAILURE) { + if (zend_u_hash_quick_find(EG(active_symbol_table), IS_UNICODE, cv->name, cv->name_len+1, cv->hash_value, (void **) &value) == FAILURE) { isset = 0; } } else { @@ -4015,7 +4015,7 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, ANY) if (Z_TYPE_P(varname) != IS_STRING && Z_TYPE_P(varname) != IS_UNICODE) { tmp = *varname; zval_copy_ctor(&tmp); - convert_to_text(&tmp); + convert_to_unicode(&tmp); varname = &tmp; } @@ -4099,7 +4099,7 @@ ZEND_VM_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, VAR|UNUSED|CV, CONST| int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { + if (ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int norm_len; @@ -4121,7 +4121,7 @@ ZEND_VM_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, VAR|UNUSED|CV, CONST| break; } case IS_NULL: - if (zend_u_hash_find(ht, ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), (void **) &value) == SUCCESS) { + if (zend_u_hash_find(ht, IS_UNICODE, EMPTY_ZSTR, sizeof(""), (void **) &value) == SUCCESS) { isset = 1; } break; @@ -4555,6 +4555,10 @@ ZEND_VM_HANDLER(150, ZEND_USER_OPCODE, ANY, ANY) ZEND_VM_HANDLER(151, ZEND_U_NORMALIZE, CONST|TMP|VAR|CV, ANY) { + zval var_copy; + int use_copy; + UChar *norm; + int norm_len; zend_op *opline = EX(opline); zend_free_op free_op1; zval *string = GET_OP1_ZVAL_PTR(BP_VAR_R); @@ -4565,25 +4569,19 @@ ZEND_VM_HANDLER(151, ZEND_U_NORMALIZE, CONST|TMP|VAR|CV, ANY) zendi_zval_copy_ctor(*result); } - if (UG(unicode)) { - zval var_copy; - int use_copy; - UChar *norm; - int norm_len; - - zend_make_unicode_zval(result, &var_copy, &use_copy); - if (use_copy) { - zval_dtor(result); - *result = var_copy; - } - if (zend_normalize_identifier(&norm, &norm_len, - Z_USTRVAL_P(result), Z_USTRLEN_P(result), 0) == FAILURE) { - zend_error(E_WARNING, "Could not normalize identifier: %r", Z_USTRVAL_P(result)); - } else if (norm != Z_USTRVAL_P(result)) { - efree(Z_USTRVAL_P(result)); - ZVAL_UNICODEL(result, norm, norm_len, 0); - } + zend_make_unicode_zval(result, &var_copy, &use_copy); + if (use_copy) { + zval_dtor(result); + *result = var_copy; } + if (zend_normalize_identifier(&norm, &norm_len, + Z_USTRVAL_P(result), Z_USTRLEN_P(result), 0) == FAILURE) { + zend_error(E_WARNING, "Could not normalize identifier: %r", Z_USTRVAL_P(result)); + } else if (norm != Z_USTRVAL_P(result)) { + efree(Z_USTRVAL_P(result)); + ZVAL_UNICODEL(result, norm, norm_len, 0); + } + FREE_OP1_IF_VAR(); ZEND_VM_NEXT_OPCODE(); } @@ -4632,7 +4630,7 @@ ZEND_VM_HANDLER(153, ZEND_DECLARE_LAMBDA_FUNCTION, CONST, CONST) zend_op *opline = EX(opline); zend_op_array *op_array; - if (zend_u_hash_quick_find(EG(function_table), UG(unicode)?IS_UNICODE:IS_STRING, Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), Z_LVAL(opline->op2.u.constant), (void *) &op_array) == FAILURE || + if (zend_u_hash_quick_find(EG(function_table), IS_UNICODE, Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), Z_LVAL(opline->op2.u.constant), (void *) &op_array) == FAILURE || op_array->type != ZEND_USER_FUNCTION) { zend_error_noreturn(E_ERROR, "Base lambda function for closure not found"); } diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index c39d5449dc..da14be8ca5 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1234,7 +1234,7 @@ static int ZEND_FASTCALL ZEND_CATCH_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) *EX(CVs)[opline->op2.u.var] = EG(exception); } else { zend_compiled_variable *cv = &CV_DEF_OF(opline->op2.u.var); - zend_u_hash_quick_update(EG(active_symbol_table), ZEND_STR_TYPE, cv->name, cv->name_len+1, cv->hash_value, + zend_u_hash_quick_update(EG(active_symbol_table), IS_UNICODE, cv->name, cv->name_len+1, cv->hash_value, &EG(exception), sizeof(zval *), (void**)&EX(CVs)[opline->op2.u.var]); } EG(exception) = NULL; @@ -1291,7 +1291,7 @@ static int ZEND_FASTCALL ZEND_ECHO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval_dtor(&z_conv); ucnv_close(script_enc_conv); } else if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get_method != NULL && - zend_std_cast_object_tostring(z, &z_copy, ZEND_STR_TYPE, ZEND_U_CONVERTER(UG(output_encoding_conv)) TSRMLS_CC) == SUCCESS) { + zend_std_cast_object_tostring(z, &z_copy, IS_UNICODE, ZEND_U_CONVERTER(UG(output_encoding_conv)) TSRMLS_CC) == SUCCESS) { zend_print_variable(&z_copy); zval_dtor(&z_copy); } else { @@ -1325,7 +1325,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST(int type, ZEND Z_TYPE_P(varname) != IS_UNICODE) { tmp_varname = *varname; zval_copy_ctor(&tmp_varname); - convert_to_text(&tmp_varname); + convert_to_unicode(&tmp_varname); varname = &tmp_varname; } @@ -1892,7 +1892,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HA zval tmp_inc_filename; zend_bool failure_retval=0; - if (UG(unicode) && Z_LVAL(opline->op2.u.constant) == ZEND_EVAL) { + if (Z_LVAL(opline->op2.u.constant) == ZEND_EVAL) { if (Z_TYPE_P(inc_filename) != IS_UNICODE) { tmp_inc_filename = *inc_filename; zval_copy_ctor(&tmp_inc_filename); @@ -2045,7 +2045,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ zend_execute_data *ex = EX(prev_execute_data); zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.u.var); - if (zend_u_hash_quick_del(EG(active_symbol_table), ZEND_STR_TYPE, cv->name, cv->name_len+1, cv->hash_value) == SUCCESS) { + if (zend_u_hash_quick_del(EG(active_symbol_table), IS_UNICODE, cv->name, cv->name_len+1, cv->hash_value) == SUCCESS) { while (ex && ex->symbol_table == EG(active_symbol_table)) { int i; @@ -2053,7 +2053,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ for (i = 0; i < ex->op_array->last_var; i++) { if (ex->op_array->vars[i].hash_value == cv->hash_value && ex->op_array->vars[i].name_len == cv->name_len && - !memcmp(ex->op_array->vars[i].name.v, cv->name.v, USTR_BYTES(ZEND_STR_TYPE, cv->name_len))) { + !memcmp(ex->op_array->vars[i].name.v, cv->name.v, USTR_BYTES(IS_UNICODE, cv->name_len))) { ex->CVs[i] = NULL; break; } @@ -2075,7 +2075,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ if (Z_TYPE_P(varname) != IS_STRING && Z_TYPE_P(varname) != IS_UNICODE) { tmp = *varname; zval_copy_ctor(&tmp); - convert_to_text(&tmp); + convert_to_unicode(&tmp); varname = &tmp; } else if (IS_CONST == IS_VAR || IS_CONST == IS_CV) { Z_ADDREF_P(varname); @@ -2285,7 +2285,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_ } else if (EG(active_symbol_table)) { zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.u.var); - if (zend_u_hash_quick_find(EG(active_symbol_table), ZEND_STR_TYPE, cv->name, cv->name_len+1, cv->hash_value, (void **) &value) == FAILURE) { + if (zend_u_hash_quick_find(EG(active_symbol_table), IS_UNICODE, cv->name, cv->name_len+1, cv->hash_value, (void **) &value) == FAILURE) { isset = 0; } } else { @@ -2299,7 +2299,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_ if (Z_TYPE_P(varname) != IS_STRING && Z_TYPE_P(varname) != IS_UNICODE) { tmp = *varname; zval_copy_ctor(&tmp); - convert_to_text(&tmp); + convert_to_unicode(&tmp); varname = &tmp; } @@ -2411,6 +2411,10 @@ static int ZEND_FASTCALL ZEND_TICKS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS static int ZEND_FASTCALL ZEND_U_NORMALIZE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { + zval var_copy; + int use_copy; + UChar *norm; + int norm_len; zend_op *opline = EX(opline); zval *string = &opline->op1.u.constant; @@ -2421,24 +2425,17 @@ static int ZEND_FASTCALL ZEND_U_NORMALIZE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLE zendi_zval_copy_ctor(*result); } - if (UG(unicode)) { - zval var_copy; - int use_copy; - UChar *norm; - int norm_len; - - zend_make_unicode_zval(result, &var_copy, &use_copy); - if (use_copy) { - zval_dtor(result); - *result = var_copy; - } - if (zend_normalize_identifier(&norm, &norm_len, - Z_USTRVAL_P(result), Z_USTRLEN_P(result), 0) == FAILURE) { - zend_error(E_WARNING, "Could not normalize identifier: %r", Z_USTRVAL_P(result)); - } else if (norm != Z_USTRVAL_P(result)) { - efree(Z_USTRVAL_P(result)); - ZVAL_UNICODEL(result, norm, norm_len, 0); - } + zend_make_unicode_zval(result, &var_copy, &use_copy); + if (use_copy) { + zval_dtor(result); + *result = var_copy; + } + if (zend_normalize_identifier(&norm, &norm_len, + Z_USTRVAL_P(result), Z_USTRLEN_P(result), 0) == FAILURE) { + zend_error(E_WARNING, "Could not normalize identifier: %r", Z_USTRVAL_P(result)); + } else if (norm != Z_USTRVAL_P(result)) { + efree(Z_USTRVAL_P(result)); + ZVAL_UNICODEL(result, norm, norm_len, 0); } ZEND_VM_NEXT_OPCODE(); @@ -2976,7 +2973,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_O zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_u_hash_update(Z_ARRVAL_P(array_ptr), ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_u_hash_update(Z_ARRVAL_P(array_ptr), IS_UNICODE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -3053,7 +3050,7 @@ static int ZEND_FASTCALL ZEND_DECLARE_LAMBDA_FUNCTION_SPEC_CONST_CONST_HANDLER( zend_op *opline = EX(opline); zend_op_array *op_array; - if (zend_u_hash_quick_find(EG(function_table), UG(unicode)?IS_UNICODE:IS_STRING, Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), Z_LVAL(opline->op2.u.constant), (void *) &op_array) == FAILURE || + if (zend_u_hash_quick_find(EG(function_table), IS_UNICODE, Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), Z_LVAL(opline->op2.u.constant), (void *) &op_array) == FAILURE || op_array->type != ZEND_USER_FUNCTION) { zend_error_noreturn(E_ERROR, "Base lambda function for closure not found"); } @@ -3501,7 +3498,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_TMP_HANDLER(ZEND_OPC zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_u_hash_update(Z_ARRVAL_P(array_ptr), ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_u_hash_update(Z_ARRVAL_P(array_ptr), IS_UNICODE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -3973,7 +3970,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_VAR_HANDLER(ZEND_OPC zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_u_hash_update(Z_ARRVAL_P(array_ptr), ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_u_hash_update(Z_ARRVAL_P(array_ptr), IS_UNICODE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -4169,7 +4166,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_UNUSED_HANDLER(ZEND_ zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_u_hash_update(Z_ARRVAL_P(array_ptr), ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_u_hash_update(Z_ARRVAL_P(array_ptr), IS_UNICODE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -4640,7 +4637,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CV_HANDLER(ZEND_OPCO zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_u_hash_update(Z_ARRVAL_P(array_ptr), ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_u_hash_update(Z_ARRVAL_P(array_ptr), IS_UNICODE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -4724,7 +4721,7 @@ static int ZEND_FASTCALL ZEND_ECHO_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval_dtor(&z_conv); ucnv_close(script_enc_conv); } else if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get_method != NULL && - zend_std_cast_object_tostring(z, &z_copy, ZEND_STR_TYPE, ZEND_U_CONVERTER(UG(output_encoding_conv)) TSRMLS_CC) == SUCCESS) { + zend_std_cast_object_tostring(z, &z_copy, IS_UNICODE, ZEND_U_CONVERTER(UG(output_encoding_conv)) TSRMLS_CC) == SUCCESS) { zend_print_variable(&z_copy); zval_dtor(&z_copy); } else { @@ -4759,7 +4756,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP(int type, ZEND_O Z_TYPE_P(varname) != IS_UNICODE) { tmp_varname = *varname; zval_copy_ctor(&tmp_varname); - convert_to_text(&tmp_varname); + convert_to_unicode(&tmp_varname); varname = &tmp_varname; } @@ -5316,7 +5313,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND zval tmp_inc_filename; zend_bool failure_retval=0; - if (UG(unicode) && Z_LVAL(opline->op2.u.constant) == ZEND_EVAL) { + if (Z_LVAL(opline->op2.u.constant) == ZEND_EVAL) { if (Z_TYPE_P(inc_filename) != IS_UNICODE) { tmp_inc_filename = *inc_filename; zval_copy_ctor(&tmp_inc_filename); @@ -5469,7 +5466,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR zend_execute_data *ex = EX(prev_execute_data); zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.u.var); - if (zend_u_hash_quick_del(EG(active_symbol_table), ZEND_STR_TYPE, cv->name, cv->name_len+1, cv->hash_value) == SUCCESS) { + if (zend_u_hash_quick_del(EG(active_symbol_table), IS_UNICODE, cv->name, cv->name_len+1, cv->hash_value) == SUCCESS) { while (ex && ex->symbol_table == EG(active_symbol_table)) { int i; @@ -5477,7 +5474,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR for (i = 0; i < ex->op_array->last_var; i++) { if (ex->op_array->vars[i].hash_value == cv->hash_value && ex->op_array->vars[i].name_len == cv->name_len && - !memcmp(ex->op_array->vars[i].name.v, cv->name.v, USTR_BYTES(ZEND_STR_TYPE, cv->name_len))) { + !memcmp(ex->op_array->vars[i].name.v, cv->name.v, USTR_BYTES(IS_UNICODE, cv->name_len))) { ex->CVs[i] = NULL; break; } @@ -5499,7 +5496,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR if (Z_TYPE_P(varname) != IS_STRING && Z_TYPE_P(varname) != IS_UNICODE) { tmp = *varname; zval_copy_ctor(&tmp); - convert_to_text(&tmp); + convert_to_unicode(&tmp); varname = &tmp; } else if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) { Z_ADDREF_P(varname); @@ -5709,7 +5706,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HA } else if (EG(active_symbol_table)) { zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.u.var); - if (zend_u_hash_quick_find(EG(active_symbol_table), ZEND_STR_TYPE, cv->name, cv->name_len+1, cv->hash_value, (void **) &value) == FAILURE) { + if (zend_u_hash_quick_find(EG(active_symbol_table), IS_UNICODE, cv->name, cv->name_len+1, cv->hash_value, (void **) &value) == FAILURE) { isset = 0; } } else { @@ -5723,7 +5720,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HA if (Z_TYPE_P(varname) != IS_STRING && Z_TYPE_P(varname) != IS_UNICODE) { tmp = *varname; zval_copy_ctor(&tmp); - convert_to_text(&tmp); + convert_to_unicode(&tmp); varname = &tmp; } @@ -5858,6 +5855,10 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_A static int ZEND_FASTCALL ZEND_U_NORMALIZE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { + zval var_copy; + int use_copy; + UChar *norm; + int norm_len; zend_op *opline = EX(opline); zend_free_op free_op1; zval *string = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); @@ -5868,24 +5869,17 @@ static int ZEND_FASTCALL ZEND_U_NORMALIZE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ zendi_zval_copy_ctor(*result); } - if (UG(unicode)) { - zval var_copy; - int use_copy; - UChar *norm; - int norm_len; - - zend_make_unicode_zval(result, &var_copy, &use_copy); - if (use_copy) { - zval_dtor(result); - *result = var_copy; - } - if (zend_normalize_identifier(&norm, &norm_len, - Z_USTRVAL_P(result), Z_USTRLEN_P(result), 0) == FAILURE) { - zend_error(E_WARNING, "Could not normalize identifier: %r", Z_USTRVAL_P(result)); - } else if (norm != Z_USTRVAL_P(result)) { - efree(Z_USTRVAL_P(result)); - ZVAL_UNICODEL(result, norm, norm_len, 0); - } + zend_make_unicode_zval(result, &var_copy, &use_copy); + if (use_copy) { + zval_dtor(result); + *result = var_copy; + } + if (zend_normalize_identifier(&norm, &norm_len, + Z_USTRVAL_P(result), Z_USTRLEN_P(result), 0) == FAILURE) { + zend_error(E_WARNING, "Could not normalize identifier: %r", Z_USTRVAL_P(result)); + } else if (norm != Z_USTRVAL_P(result)) { + efree(Z_USTRVAL_P(result)); + ZVAL_UNICODEL(result, norm, norm_len, 0); } ZEND_VM_NEXT_OPCODE(); @@ -6209,7 +6203,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CONST_HANDLER(ZEND_OPCO int function_name_strlen; zend_free_op free_op1; /* FIXME: type is default */ - zend_uchar type = UG(unicode)?IS_UNICODE:IS_STRING; + zend_uchar type = IS_UNICODE; zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); @@ -6351,7 +6345,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CONST_HANDLER(ZEND_OPC zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_u_hash_update(Z_ARRVAL_P(array_ptr), ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_u_hash_update(Z_ARRVAL_P(array_ptr), IS_UNICODE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -6682,7 +6676,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE int function_name_strlen; zend_free_op free_op1, free_op2; /* FIXME: type is default */ - zend_uchar type = UG(unicode)?IS_UNICODE:IS_STRING; + zend_uchar type = IS_UNICODE; zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); @@ -6826,7 +6820,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_TMP_HANDLER(ZEND_OPCOD zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_u_hash_update(Z_ARRVAL_P(array_ptr), ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_u_hash_update(Z_ARRVAL_P(array_ptr), IS_UNICODE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -7157,7 +7151,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE int function_name_strlen; zend_free_op free_op1, free_op2; /* FIXME: type is default */ - zend_uchar type = UG(unicode)?IS_UNICODE:IS_STRING; + zend_uchar type = IS_UNICODE; zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); @@ -7301,7 +7295,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_u_hash_update(Z_ARRVAL_P(array_ptr), ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_u_hash_update(Z_ARRVAL_P(array_ptr), IS_UNICODE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -7397,7 +7391,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNUSED_HANDLER(ZEND_OP zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_u_hash_update(Z_ARRVAL_P(array_ptr), ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_u_hash_update(Z_ARRVAL_P(array_ptr), IS_UNICODE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -7727,7 +7721,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_ int function_name_strlen; zend_free_op free_op1; /* FIXME: type is default */ - zend_uchar type = UG(unicode)?IS_UNICODE:IS_STRING; + zend_uchar type = IS_UNICODE; zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); @@ -7869,7 +7863,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CV_HANDLER(ZEND_OPCODE zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_u_hash_update(Z_ARRVAL_P(array_ptr), ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_u_hash_update(Z_ARRVAL_P(array_ptr), IS_UNICODE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -8111,7 +8105,7 @@ static int ZEND_FASTCALL ZEND_ECHO_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval_dtor(&z_conv); ucnv_close(script_enc_conv); } else if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get_method != NULL && - zend_std_cast_object_tostring(z, &z_copy, ZEND_STR_TYPE, ZEND_U_CONVERTER(UG(output_encoding_conv)) TSRMLS_CC) == SUCCESS) { + zend_std_cast_object_tostring(z, &z_copy, IS_UNICODE, ZEND_U_CONVERTER(UG(output_encoding_conv)) TSRMLS_CC) == SUCCESS) { zend_print_variable(&z_copy); zval_dtor(&z_copy); } else { @@ -8146,7 +8140,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR(int type, ZEND_O Z_TYPE_P(varname) != IS_UNICODE) { tmp_varname = *varname; zval_copy_ctor(&tmp_varname); - convert_to_text(&tmp_varname); + convert_to_unicode(&tmp_varname); varname = &tmp_varname; } @@ -8812,7 +8806,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND zval tmp_inc_filename; zend_bool failure_retval=0; - if (UG(unicode) && Z_LVAL(opline->op2.u.constant) == ZEND_EVAL) { + if (Z_LVAL(opline->op2.u.constant) == ZEND_EVAL) { if (Z_TYPE_P(inc_filename) != IS_UNICODE) { tmp_inc_filename = *inc_filename; zval_copy_ctor(&tmp_inc_filename); @@ -8965,7 +8959,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR zend_execute_data *ex = EX(prev_execute_data); zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.u.var); - if (zend_u_hash_quick_del(EG(active_symbol_table), ZEND_STR_TYPE, cv->name, cv->name_len+1, cv->hash_value) == SUCCESS) { + if (zend_u_hash_quick_del(EG(active_symbol_table), IS_UNICODE, cv->name, cv->name_len+1, cv->hash_value) == SUCCESS) { while (ex && ex->symbol_table == EG(active_symbol_table)) { int i; @@ -8973,7 +8967,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR for (i = 0; i < ex->op_array->last_var; i++) { if (ex->op_array->vars[i].hash_value == cv->hash_value && ex->op_array->vars[i].name_len == cv->name_len && - !memcmp(ex->op_array->vars[i].name.v, cv->name.v, USTR_BYTES(ZEND_STR_TYPE, cv->name_len))) { + !memcmp(ex->op_array->vars[i].name.v, cv->name.v, USTR_BYTES(IS_UNICODE, cv->name_len))) { ex->CVs[i] = NULL; break; } @@ -8995,7 +8989,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR if (Z_TYPE_P(varname) != IS_STRING && Z_TYPE_P(varname) != IS_UNICODE) { tmp = *varname; zval_copy_ctor(&tmp); - convert_to_text(&tmp); + convert_to_unicode(&tmp); varname = &tmp; } else if (IS_VAR == IS_VAR || IS_VAR == IS_CV) { Z_ADDREF_P(varname); @@ -9361,7 +9355,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HA } else if (EG(active_symbol_table)) { zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.u.var); - if (zend_u_hash_quick_find(EG(active_symbol_table), ZEND_STR_TYPE, cv->name, cv->name_len+1, cv->hash_value, (void **) &value) == FAILURE) { + if (zend_u_hash_quick_find(EG(active_symbol_table), IS_UNICODE, cv->name, cv->name_len+1, cv->hash_value, (void **) &value) == FAILURE) { isset = 0; } } else { @@ -9375,7 +9369,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HA if (Z_TYPE_P(varname) != IS_STRING && Z_TYPE_P(varname) != IS_UNICODE) { tmp = *varname; zval_copy_ctor(&tmp); - convert_to_text(&tmp); + convert_to_unicode(&tmp); varname = &tmp; } @@ -9492,6 +9486,10 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_A static int ZEND_FASTCALL ZEND_U_NORMALIZE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { + zval var_copy; + int use_copy; + UChar *norm; + int norm_len; zend_op *opline = EX(opline); zend_free_op free_op1; zval *string = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); @@ -9502,25 +9500,19 @@ static int ZEND_FASTCALL ZEND_U_NORMALIZE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ zendi_zval_copy_ctor(*result); } - if (UG(unicode)) { - zval var_copy; - int use_copy; - UChar *norm; - int norm_len; - - zend_make_unicode_zval(result, &var_copy, &use_copy); - if (use_copy) { - zval_dtor(result); - *result = var_copy; - } - if (zend_normalize_identifier(&norm, &norm_len, - Z_USTRVAL_P(result), Z_USTRLEN_P(result), 0) == FAILURE) { - zend_error(E_WARNING, "Could not normalize identifier: %r", Z_USTRVAL_P(result)); - } else if (norm != Z_USTRVAL_P(result)) { - efree(Z_USTRVAL_P(result)); - ZVAL_UNICODEL(result, norm, norm_len, 0); - } + zend_make_unicode_zval(result, &var_copy, &use_copy); + if (use_copy) { + zval_dtor(result); + *result = var_copy; + } + if (zend_normalize_identifier(&norm, &norm_len, + Z_USTRVAL_P(result), Z_USTRLEN_P(result), 0) == FAILURE) { + zend_error(E_WARNING, "Could not normalize identifier: %r", Z_USTRVAL_P(result)); + } else if (norm != Z_USTRVAL_P(result)) { + efree(Z_USTRVAL_P(result)); + ZVAL_UNICODEL(result, norm, norm_len, 0); } + if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); } @@ -10759,7 +10751,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCO int function_name_strlen; zend_free_op free_op1; /* FIXME: type is default */ - zend_uchar type = UG(unicode)?IS_UNICODE:IS_STRING; + zend_uchar type = IS_UNICODE; zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); @@ -11071,7 +11063,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CONST_HANDLER(ZEND_OPC zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_u_hash_update(Z_ARRVAL_P(array_ptr), ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_u_hash_update(Z_ARRVAL_P(array_ptr), IS_UNICODE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -11138,7 +11130,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { + if (ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int norm_len; @@ -11185,7 +11177,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND break; } case IS_NULL: - zend_u_hash_del(ht, ZEND_STR_TYPE, EMPTY_ZSTR, sizeof("")); + zend_u_hash_del(ht, IS_UNICODE, EMPTY_ZSTR, sizeof("")); break; default: zend_error(E_WARNING, "Illegal offset type in unset"); @@ -11300,7 +11292,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST( int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { + if (ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int norm_len; @@ -11322,7 +11314,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST( break; } case IS_NULL: - if (zend_u_hash_find(ht, ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), (void **) &value) == SUCCESS) { + if (zend_u_hash_find(ht, IS_UNICODE, EMPTY_ZSTR, sizeof(""), (void **) &value) == SUCCESS) { isset = 1; } break; @@ -12644,7 +12636,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE int function_name_strlen; zend_free_op free_op1, free_op2; /* FIXME: type is default */ - zend_uchar type = UG(unicode)?IS_UNICODE:IS_STRING; + zend_uchar type = IS_UNICODE; zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); @@ -12889,7 +12881,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMP_HANDLER(ZEND_OPCOD zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_u_hash_update(Z_ARRVAL_P(array_ptr), ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_u_hash_update(Z_ARRVAL_P(array_ptr), IS_UNICODE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -12956,7 +12948,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLE int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { + if (ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int norm_len; @@ -13003,7 +12995,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLE break; } case IS_NULL: - zend_u_hash_del(ht, ZEND_STR_TYPE, EMPTY_ZSTR, sizeof("")); + zend_u_hash_del(ht, IS_UNICODE, EMPTY_ZSTR, sizeof("")); break; default: zend_error(E_WARNING, "Illegal offset type in unset"); @@ -13118,7 +13110,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(in int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { + if (ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int norm_len; @@ -13140,7 +13132,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(in break; } case IS_NULL: - if (zend_u_hash_find(ht, ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), (void **) &value) == SUCCESS) { + if (zend_u_hash_find(ht, IS_UNICODE, EMPTY_ZSTR, sizeof(""), (void **) &value) == SUCCESS) { isset = 1; } break; @@ -14513,7 +14505,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE int function_name_strlen; zend_free_op free_op1, free_op2; /* FIXME: type is default */ - zend_uchar type = UG(unicode)?IS_UNICODE:IS_STRING; + zend_uchar type = IS_UNICODE; zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); @@ -14758,7 +14750,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_u_hash_update(Z_ARRVAL_P(array_ptr), ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_u_hash_update(Z_ARRVAL_P(array_ptr), IS_UNICODE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -14825,7 +14817,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { + if (ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int norm_len; @@ -14872,7 +14864,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE break; } case IS_NULL: - zend_u_hash_del(ht, ZEND_STR_TYPE, EMPTY_ZSTR, sizeof("")); + zend_u_hash_del(ht, IS_UNICODE, EMPTY_ZSTR, sizeof("")); break; default: zend_error(E_WARNING, "Illegal offset type in unset"); @@ -14987,7 +14979,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(in int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { + if (ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int norm_len; @@ -15009,7 +15001,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(in break; } case IS_NULL: - if (zend_u_hash_find(ht, ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), (void **) &value) == SUCCESS) { + if (zend_u_hash_find(ht, IS_UNICODE, EMPTY_ZSTR, sizeof(""), (void **) &value) == SUCCESS) { isset = 1; } break; @@ -15684,7 +15676,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_UNUSED_HANDLER(ZEND_OP zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_u_hash_update(Z_ARRVAL_P(array_ptr), ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_u_hash_update(Z_ARRVAL_P(array_ptr), IS_UNICODE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -16975,7 +16967,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_ int function_name_strlen; zend_free_op free_op1; /* FIXME: type is default */ - zend_uchar type = UG(unicode)?IS_UNICODE:IS_STRING; + zend_uchar type = IS_UNICODE; zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); @@ -17218,7 +17210,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_u_hash_update(Z_ARRVAL_P(array_ptr), ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_u_hash_update(Z_ARRVAL_P(array_ptr), IS_UNICODE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -17285,7 +17277,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { + if (ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int norm_len; @@ -17332,7 +17324,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER break; } case IS_NULL: - zend_u_hash_del(ht, ZEND_STR_TYPE, EMPTY_ZSTR, sizeof("")); + zend_u_hash_del(ht, IS_UNICODE, EMPTY_ZSTR, sizeof("")); break; default: zend_error(E_WARNING, "Illegal offset type in unset"); @@ -17447,7 +17439,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { + if (ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int norm_len; @@ -17469,7 +17461,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int break; } case IS_NULL: - if (zend_u_hash_find(ht, ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), (void **) &value) == SUCCESS) { + if (zend_u_hash_find(ht, IS_UNICODE, EMPTY_ZSTR, sizeof(""), (void **) &value) == SUCCESS) { isset = 1; } break; @@ -18382,7 +18374,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER(ZEND_O int function_name_strlen; /* FIXME: type is default */ - zend_uchar type = UG(unicode)?IS_UNICODE:IS_STRING; + zend_uchar type = IS_UNICODE; zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); @@ -18547,7 +18539,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_H int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { + if (ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int norm_len; @@ -18594,7 +18586,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_H break; } case IS_NULL: - zend_u_hash_del(ht, ZEND_STR_TYPE, EMPTY_ZSTR, sizeof("")); + zend_u_hash_del(ht, IS_UNICODE, EMPTY_ZSTR, sizeof("")); break; default: zend_error(E_WARNING, "Illegal offset type in unset"); @@ -18707,7 +18699,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CON int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { + if (ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int norm_len; @@ -18729,7 +18721,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CON break; } case IS_NULL: - if (zend_u_hash_find(ht, ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), (void **) &value) == SUCCESS) { + if (zend_u_hash_find(ht, IS_UNICODE, EMPTY_ZSTR, sizeof(""), (void **) &value) == SUCCESS) { isset = 1; } break; @@ -19571,7 +19563,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPC int function_name_strlen; zend_free_op free_op2; /* FIXME: type is default */ - zend_uchar type = UG(unicode)?IS_UNICODE:IS_STRING; + zend_uchar type = IS_UNICODE; zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); @@ -19668,7 +19660,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HAN int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { + if (ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int norm_len; @@ -19715,7 +19707,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HAN break; } case IS_NULL: - zend_u_hash_del(ht, ZEND_STR_TYPE, EMPTY_ZSTR, sizeof("")); + zend_u_hash_del(ht, IS_UNICODE, EMPTY_ZSTR, sizeof("")); break; default: zend_error(E_WARNING, "Illegal offset type in unset"); @@ -19828,7 +19820,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { + if (ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int norm_len; @@ -19850,7 +19842,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP break; } case IS_NULL: - if (zend_u_hash_find(ht, ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), (void **) &value) == SUCCESS) { + if (zend_u_hash_find(ht, IS_UNICODE, EMPTY_ZSTR, sizeof(""), (void **) &value) == SUCCESS) { isset = 1; } break; @@ -20692,7 +20684,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPC int function_name_strlen; zend_free_op free_op2; /* FIXME: type is default */ - zend_uchar type = UG(unicode)?IS_UNICODE:IS_STRING; + zend_uchar type = IS_UNICODE; zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); @@ -20789,7 +20781,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HAN int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { + if (ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int norm_len; @@ -20836,7 +20828,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HAN break; } case IS_NULL: - zend_u_hash_del(ht, ZEND_STR_TYPE, EMPTY_ZSTR, sizeof("")); + zend_u_hash_del(ht, IS_UNICODE, EMPTY_ZSTR, sizeof("")); break; default: zend_error(E_WARNING, "Illegal offset type in unset"); @@ -20949,7 +20941,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { + if (ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int norm_len; @@ -20971,7 +20963,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR break; } case IS_NULL: - if (zend_u_hash_find(ht, ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), (void **) &value) == SUCCESS) { + if (zend_u_hash_find(ht, IS_UNICODE, EMPTY_ZSTR, sizeof(""), (void **) &value) == SUCCESS) { isset = 1; } break; @@ -22072,7 +22064,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCO int function_name_strlen; /* FIXME: type is default */ - zend_uchar type = UG(unicode)?IS_UNICODE:IS_STRING; + zend_uchar type = IS_UNICODE; zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); @@ -22168,7 +22160,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HAND int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { + if (ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int norm_len; @@ -22215,7 +22207,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HAND break; } case IS_NULL: - zend_u_hash_del(ht, ZEND_STR_TYPE, EMPTY_ZSTR, sizeof("")); + zend_u_hash_del(ht, IS_UNICODE, EMPTY_ZSTR, sizeof("")); break; default: zend_error(E_WARNING, "Illegal offset type in unset"); @@ -22328,7 +22320,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV( int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { + if (ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int norm_len; @@ -22350,7 +22342,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV( break; } case IS_NULL: - if (zend_u_hash_find(ht, ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), (void **) &value) == SUCCESS) { + if (zend_u_hash_find(ht, IS_UNICODE, EMPTY_ZSTR, sizeof(""), (void **) &value) == SUCCESS) { isset = 1; } break; @@ -22664,7 +22656,7 @@ static int ZEND_FASTCALL ZEND_ECHO_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval_dtor(&z_conv); ucnv_close(script_enc_conv); } else if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get_method != NULL && - zend_std_cast_object_tostring(z, &z_copy, ZEND_STR_TYPE, ZEND_U_CONVERTER(UG(output_encoding_conv)) TSRMLS_CC) == SUCCESS) { + zend_std_cast_object_tostring(z, &z_copy, IS_UNICODE, ZEND_U_CONVERTER(UG(output_encoding_conv)) TSRMLS_CC) == SUCCESS) { zend_print_variable(&z_copy); zval_dtor(&z_copy); } else { @@ -22698,7 +22690,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV(int type, ZEND_OP Z_TYPE_P(varname) != IS_UNICODE) { tmp_varname = *varname; zval_copy_ctor(&tmp_varname); - convert_to_text(&tmp_varname); + convert_to_unicode(&tmp_varname); varname = &tmp_varname; } @@ -23354,7 +23346,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL zval tmp_inc_filename; zend_bool failure_retval=0; - if (UG(unicode) && Z_LVAL(opline->op2.u.constant) == ZEND_EVAL) { + if (Z_LVAL(opline->op2.u.constant) == ZEND_EVAL) { if (Z_TYPE_P(inc_filename) != IS_UNICODE) { tmp_inc_filename = *inc_filename; zval_copy_ctor(&tmp_inc_filename); @@ -23507,7 +23499,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG zend_execute_data *ex = EX(prev_execute_data); zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.u.var); - if (zend_u_hash_quick_del(EG(active_symbol_table), ZEND_STR_TYPE, cv->name, cv->name_len+1, cv->hash_value) == SUCCESS) { + if (zend_u_hash_quick_del(EG(active_symbol_table), IS_UNICODE, cv->name, cv->name_len+1, cv->hash_value) == SUCCESS) { while (ex && ex->symbol_table == EG(active_symbol_table)) { int i; @@ -23515,7 +23507,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG for (i = 0; i < ex->op_array->last_var; i++) { if (ex->op_array->vars[i].hash_value == cv->hash_value && ex->op_array->vars[i].name_len == cv->name_len && - !memcmp(ex->op_array->vars[i].name.v, cv->name.v, USTR_BYTES(ZEND_STR_TYPE, cv->name_len))) { + !memcmp(ex->op_array->vars[i].name.v, cv->name.v, USTR_BYTES(IS_UNICODE, cv->name_len))) { ex->CVs[i] = NULL; break; } @@ -23537,7 +23529,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG if (Z_TYPE_P(varname) != IS_STRING && Z_TYPE_P(varname) != IS_UNICODE) { tmp = *varname; zval_copy_ctor(&tmp); - convert_to_text(&tmp); + convert_to_unicode(&tmp); varname = &tmp; } else if (IS_CV == IS_VAR || IS_CV == IS_CV) { Z_ADDREF_P(varname); @@ -23747,7 +23739,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HAN } else if (EG(active_symbol_table)) { zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.u.var); - if (zend_u_hash_quick_find(EG(active_symbol_table), ZEND_STR_TYPE, cv->name, cv->name_len+1, cv->hash_value, (void **) &value) == FAILURE) { + if (zend_u_hash_quick_find(EG(active_symbol_table), IS_UNICODE, cv->name, cv->name_len+1, cv->hash_value, (void **) &value) == FAILURE) { isset = 0; } } else { @@ -23761,7 +23753,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HAN if (Z_TYPE_P(varname) != IS_STRING && Z_TYPE_P(varname) != IS_UNICODE) { tmp = *varname; zval_copy_ctor(&tmp); - convert_to_text(&tmp); + convert_to_unicode(&tmp); varname = &tmp; } @@ -23877,6 +23869,10 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_AR static int ZEND_FASTCALL ZEND_U_NORMALIZE_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { + zval var_copy; + int use_copy; + UChar *norm; + int norm_len; zend_op *opline = EX(opline); zval *string = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); @@ -23887,24 +23883,17 @@ static int ZEND_FASTCALL ZEND_U_NORMALIZE_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_A zendi_zval_copy_ctor(*result); } - if (UG(unicode)) { - zval var_copy; - int use_copy; - UChar *norm; - int norm_len; - - zend_make_unicode_zval(result, &var_copy, &use_copy); - if (use_copy) { - zval_dtor(result); - *result = var_copy; - } - if (zend_normalize_identifier(&norm, &norm_len, - Z_USTRVAL_P(result), Z_USTRLEN_P(result), 0) == FAILURE) { - zend_error(E_WARNING, "Could not normalize identifier: %r", Z_USTRVAL_P(result)); - } else if (norm != Z_USTRVAL_P(result)) { - efree(Z_USTRVAL_P(result)); - ZVAL_UNICODEL(result, norm, norm_len, 0); - } + zend_make_unicode_zval(result, &var_copy, &use_copy); + if (use_copy) { + zval_dtor(result); + *result = var_copy; + } + if (zend_normalize_identifier(&norm, &norm_len, + Z_USTRVAL_P(result), Z_USTRLEN_P(result), 0) == FAILURE) { + zend_error(E_WARNING, "Could not normalize identifier: %r", Z_USTRVAL_P(result)); + } else if (norm != Z_USTRVAL_P(result)) { + efree(Z_USTRVAL_P(result)); + ZVAL_UNICODEL(result, norm, norm_len, 0); } ZEND_VM_NEXT_OPCODE(); @@ -25137,7 +25126,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER(ZEND_OPCOD int function_name_strlen; /* FIXME: type is default */ - zend_uchar type = UG(unicode)?IS_UNICODE:IS_STRING; + zend_uchar type = IS_UNICODE; zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); @@ -25279,7 +25268,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CONST_HANDLER(ZEND_OPCO zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_u_hash_update(Z_ARRVAL_P(array_ptr), ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_u_hash_update(Z_ARRVAL_P(array_ptr), IS_UNICODE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -25346,7 +25335,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { + if (ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int norm_len; @@ -25393,7 +25382,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL break; } case IS_NULL: - zend_u_hash_del(ht, ZEND_STR_TYPE, EMPTY_ZSTR, sizeof("")); + zend_u_hash_del(ht, IS_UNICODE, EMPTY_ZSTR, sizeof("")); break; default: zend_error(E_WARNING, "Illegal offset type in unset"); @@ -25506,7 +25495,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(i int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { + if (ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int norm_len; @@ -25528,7 +25517,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(i break; } case IS_NULL: - if (zend_u_hash_find(ht, ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), (void **) &value) == SUCCESS) { + if (zend_u_hash_find(ht, IS_UNICODE, EMPTY_ZSTR, sizeof(""), (void **) &value) == SUCCESS) { isset = 1; } break; @@ -26841,7 +26830,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_ int function_name_strlen; zend_free_op free_op2; /* FIXME: type is default */ - zend_uchar type = UG(unicode)?IS_UNICODE:IS_STRING; + zend_uchar type = IS_UNICODE; zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); @@ -26985,7 +26974,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_u_hash_update(Z_ARRVAL_P(array_ptr), ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_u_hash_update(Z_ARRVAL_P(array_ptr), IS_UNICODE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -27052,7 +27041,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { + if (ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int norm_len; @@ -27099,7 +27088,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER break; } case IS_NULL: - zend_u_hash_del(ht, ZEND_STR_TYPE, EMPTY_ZSTR, sizeof("")); + zend_u_hash_del(ht, IS_UNICODE, EMPTY_ZSTR, sizeof("")); break; default: zend_error(E_WARNING, "Illegal offset type in unset"); @@ -27212,7 +27201,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { + if (ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int norm_len; @@ -27234,7 +27223,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int break; } case IS_NULL: - if (zend_u_hash_find(ht, ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), (void **) &value) == SUCCESS) { + if (zend_u_hash_find(ht, IS_UNICODE, EMPTY_ZSTR, sizeof(""), (void **) &value) == SUCCESS) { isset = 1; } break; @@ -28597,7 +28586,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_ int function_name_strlen; zend_free_op free_op2; /* FIXME: type is default */ - zend_uchar type = UG(unicode)?IS_UNICODE:IS_STRING; + zend_uchar type = IS_UNICODE; zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); @@ -28741,7 +28730,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_u_hash_update(Z_ARRVAL_P(array_ptr), ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_u_hash_update(Z_ARRVAL_P(array_ptr), IS_UNICODE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -28808,7 +28797,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { + if (ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int norm_len; @@ -28855,7 +28844,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER break; } case IS_NULL: - zend_u_hash_del(ht, ZEND_STR_TYPE, EMPTY_ZSTR, sizeof("")); + zend_u_hash_del(ht, IS_UNICODE, EMPTY_ZSTR, sizeof("")); break; default: zend_error(E_WARNING, "Illegal offset type in unset"); @@ -28968,7 +28957,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { + if (ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int norm_len; @@ -28990,7 +28979,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int break; } case IS_NULL: - if (zend_u_hash_find(ht, ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), (void **) &value) == SUCCESS) { + if (zend_u_hash_find(ht, IS_UNICODE, EMPTY_ZSTR, sizeof(""), (void **) &value) == SUCCESS) { isset = 1; } break; @@ -29561,7 +29550,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_UNUSED_HANDLER(ZEND_OPC zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_u_hash_update(Z_ARRVAL_P(array_ptr), ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_u_hash_update(Z_ARRVAL_P(array_ptr), IS_UNICODE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -30844,7 +30833,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_H int function_name_strlen; /* FIXME: type is default */ - zend_uchar type = UG(unicode)?IS_UNICODE:IS_STRING; + zend_uchar type = IS_UNICODE; zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); @@ -30986,7 +30975,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_ zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_u_hash_update(Z_ARRVAL_P(array_ptr), ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_u_hash_update(Z_ARRVAL_P(array_ptr), IS_UNICODE, EMPTY_ZSTR, sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -31053,7 +31042,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { + if (ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int norm_len; @@ -31100,7 +31089,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ break; } case IS_NULL: - zend_u_hash_del(ht, ZEND_STR_TYPE, EMPTY_ZSTR, sizeof("")); + zend_u_hash_del(ht, IS_UNICODE, EMPTY_ZSTR, sizeof("")); break; default: zend_error(E_WARNING, "Illegal offset type in unset"); @@ -31213,7 +31202,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { + if (ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int norm_len; @@ -31235,7 +31224,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int break; } case IS_NULL: - if (zend_u_hash_find(ht, ZEND_STR_TYPE, EMPTY_ZSTR, sizeof(""), (void **) &value) == SUCCESS) { + if (zend_u_hash_find(ht, IS_UNICODE, EMPTY_ZSTR, sizeof(""), (void **) &value) == SUCCESS) { isset = 1; } break; diff --git a/ext/calendar/calendar.c b/ext/calendar/calendar.c index 0225fdaef0..f3ffa54310 100644 --- a/ext/calendar/calendar.c +++ b/ext/calendar/calendar.c @@ -632,7 +632,7 @@ PHP_FUNCTION(jdtojewish) efree(yearp); } - if (UG(unicode) && CALENDAR_G(iso_8859_8_conv)) { + if (CALENDAR_G(iso_8859_8_conv)) { RETURN_U_STRING(CALENDAR_G(iso_8859_8_conv), hebdate, ZSTR_DUPLICATE); } else { RETURN_STRING(hebdate, 1); @@ -747,7 +747,7 @@ PHP_FUNCTION(jdmonthname) case CAL_MONTH_JEWISH: /* jewish month */ SdnToJewish(julday, &year, &month, &day); monthname = JewishMonthName[month]; - if (UG(unicode) && CALENDAR_G(iso_8859_8_conv)) { + if (CALENDAR_G(iso_8859_8_conv)) { RETURN_U_STRING(CALENDAR_G(iso_8859_8_conv), monthname, ZSTR_DUPLICATE); } else { RETURN_STRING(monthname, 1); diff --git a/ext/com_dotnet/com_variant.c b/ext/com_dotnet/com_variant.c index 7e96cb12ce..44af7dd54c 100644 --- a/ext/com_dotnet/com_variant.c +++ b/ext/com_dotnet/com_variant.c @@ -217,13 +217,7 @@ PHPAPI int php_com_zval_from_variant(zval *z, VARIANT *v, int codepage TSRMLS_DC break; case VT_BSTR: if (V_BSTR(v)) { - if (UG(unicode)) { - ZVAL_UNICODE(z, V_BSTR(v), 1); - } else { - Z_TYPE_P(z) = IS_STRING; - Z_STRVAL_P(z) = php_com_olestring_to_string(V_BSTR(v), - &Z_STRLEN_P(z), codepage TSRMLS_CC); - } + ZVAL_UNICODE(z, V_BSTR(v), 1); } break; case VT_UNKNOWN: diff --git a/ext/date/php_date.c b/ext/date/php_date.c index df07b8adfd..811cecdb14 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -1055,11 +1055,7 @@ static inline int date_spprintf(char **str, size_t size TSRMLS_DC, const char *f va_start(ap, format); - if (UG(unicode)) { - c = vuspprintf((UChar**)str, size, format, ap) * sizeof(UChar); - } else { - c = vspprintf(str, size, format, ap); - } + c = vuspprintf((UChar**)str, size, format, ap) * sizeof(UChar); va_end(ap); return c; } @@ -1083,11 +1079,7 @@ static char *date_format(char *format, int format_len, int *return_len, timelib_ if (!format_len) { *return_len = 0; - if (UG(unicode)) { - return (char*)eustrdup(EMPTY_STR); - } else { - return estrdup(""); - } + return (char*)eustrdup(EMPTY_STR); } loc_dat = date_get_locale_data(UG(default_locale)); @@ -1236,11 +1228,7 @@ static char *date_format(char *format, int format_len, int *return_len, timelib_ timelib_time_offset_dtor(offset); } - if (UG(unicode)) { - *return_len = string.len / 2; - } else { - *return_len = string.len; - } + *return_len = string.len / 2; return string.c; } @@ -1260,11 +1248,7 @@ static void php_date(INTERNAL_FUNCTION_PARAMETERS, int localtime) string = php_format_date(format, format_len, ts, localtime TSRMLS_CC); - if (UG(unicode)) { - RETVAL_UNICODE((UChar*)string, 0); - } else { - RETVAL_STRING(string, 0); - } + RETVAL_UNICODE((UChar*)string, 0); } /* }}} */ @@ -1734,13 +1718,9 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt) if (real_len && real_len != buf_len) { buf = (char *) erealloc(buf, real_len + 1); - if (UG(unicode)) { - RETVAL_RT_STRINGL(buf, real_len, 1); - efree(buf); - return; - } else { - RETURN_STRINGL(buf, real_len, 0); - } + RETVAL_RT_STRINGL(buf, real_len, 1); + efree(buf); + return; } efree(buf); RETURN_FALSE; @@ -2186,11 +2166,7 @@ static HashTable *date_object_get_properties(zval *object TSRMLS_DC) /* first we add the date and time in ISO format */ str = date_format("Y-m-d H:i:s", 12, &return_len, dateobj->time, 1, 0 TSRMLS_CC); MAKE_STD_ZVAL(zv); - if (UG(unicode)) { - ZVAL_UNICODEL(zv, (UChar*) str, return_len - 1, 0); - } else { - ZVAL_STRINGL(zv, str, return_len - 1, 0); - } + ZVAL_UNICODEL(zv, (UChar*) str, return_len - 1, 0); zend_hash_update(props, "date", 5, &zv, sizeof(zval), NULL); /* then we add the timezone name (or similar) */ @@ -2816,11 +2792,7 @@ PHP_FUNCTION(date_format) dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC); DATE_CHECK_INITIALIZED(dateobj->time, DateTime); str = date_format(format, format_len, &length, dateobj->time, dateobj->time->is_localtime, 0 TSRMLS_CC); - if (UG(unicode)) { - RETURN_UNICODEL((UChar*) str, length, 0); - } else { - RETURN_STRINGL(str, length, 0); - } + RETURN_UNICODEL((UChar*) str, length, 0); } /* }}} */ @@ -2839,11 +2811,7 @@ PHP_FUNCTION(date_format_locale) dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC); str = date_format(format, format_len, &length, dateobj->time, dateobj->time->is_localtime, 1 TSRMLS_CC); - if (UG(unicode)) { - RETURN_UNICODEL((UChar*)str, length, 0); - } else { - RETURN_STRINGL(str, length, 0); - } + RETURN_UNICODEL((UChar*)str, length, 0); } /* }}} */ @@ -3399,11 +3367,7 @@ PHP_FUNCTION(timezone_transitions_get) MAKE_STD_ZVAL(element); \ array_init(element); \ add_ascii_assoc_long(element, "ts", timestamp_begin); \ - if (UG(unicode)) { \ - add_ascii_assoc_unicode(element, "time", (UChar*) php_format_date(DATE_FORMAT_ISO8601, 13, timestamp_begin, 0 TSRMLS_CC), 0); \ - } else { \ - add_assoc_string(element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, timestamp_begin, 0 TSRMLS_CC), 0); \ - } \ + add_ascii_assoc_unicode(element, "time", (UChar*) php_format_date(DATE_FORMAT_ISO8601, 13, timestamp_begin, 0 TSRMLS_CC), 0); \ add_ascii_assoc_long(element, "offset", tzobj->tzi.tz->type[0].offset); \ add_ascii_assoc_bool(element, "isdst", tzobj->tzi.tz->type[0].isdst); \ add_ascii_assoc_ascii_string(element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[0].abbr_idx], 1); \ @@ -3413,11 +3377,7 @@ PHP_FUNCTION(timezone_transitions_get) MAKE_STD_ZVAL(element); \ array_init(element); \ add_ascii_assoc_long(element, "ts", ts); \ - if (UG(unicode)) { \ - add_ascii_assoc_unicode(element, "time", (UChar*) php_format_date(DATE_FORMAT_ISO8601, 13, ts, 0 TSRMLS_CC), 0); \ - } else { \ - add_assoc_string(element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, ts, 0 TSRMLS_CC), 0); \ - } \ + add_ascii_assoc_unicode(element, "time", (UChar*) php_format_date(DATE_FORMAT_ISO8601, 13, ts, 0 TSRMLS_CC), 0); \ add_ascii_assoc_long(element, "offset", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].offset); \ add_ascii_assoc_bool(element, "isdst", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].isdst); \ add_ascii_assoc_ascii_string(element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].abbr_idx], 1); \ diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index c05f019eb1..f4dfb85b0a 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -188,9 +188,9 @@ int dom_set_doc_classmap(php_libxml_ref_obj *document, zend_class_entry *basece, zend_u_hash_init(doc_props->classmap, 0, NULL, NULL, 0, UG(unicode)); } if (ce) { - return zend_u_hash_update(doc_props->classmap, UG(unicode)?IS_UNICODE:IS_STRING, basece->name, basece->name_length + 1, &ce, sizeof(ce), NULL); + return zend_u_hash_update(doc_props->classmap, IS_UNICODE, basece->name, basece->name_length + 1, &ce, sizeof(ce), NULL); } else { - zend_u_hash_del(doc_props->classmap, UG(unicode)?IS_UNICODE:IS_STRING, basece->name, basece->name_length + 1); + zend_u_hash_del(doc_props->classmap, IS_UNICODE, basece->name, basece->name_length + 1); } } return SUCCESS; @@ -204,7 +204,7 @@ zend_class_entry *dom_get_doc_classmap(php_libxml_ref_obj *document, zend_class_ if (document) { doc_props = dom_get_doc_props(document); if (doc_props->classmap) { - if (zend_u_hash_find(doc_props->classmap, UG(unicode)?IS_UNICODE:IS_STRING, basece->name, basece->name_length + 1, (void**) &ce) == SUCCESS) { + if (zend_u_hash_find(doc_props->classmap, IS_UNICODE, basece->name, basece->name_length + 1, (void**) &ce) == SUCCESS) { return *ce; } } @@ -291,7 +291,7 @@ static zval **dom_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC) if (member->type != IS_STRING && member->type != IS_UNICODE) { tmp_member = *member; zval_copy_ctor(&tmp_member); - convert_to_text(&tmp_member); + convert_to_unicode(&tmp_member); member = &tmp_member; } @@ -324,7 +324,7 @@ zval *dom_read_property(zval *object, zval *member, int type TSRMLS_DC) if (member->type != IS_STRING && member->type != IS_UNICODE) { tmp_member = *member; zval_copy_ctor(&tmp_member); - convert_to_text(&tmp_member); + convert_to_unicode(&tmp_member); member = &tmp_member; } @@ -369,7 +369,7 @@ void dom_write_property(zval *object, zval *member, zval *value TSRMLS_DC) if (member->type != IS_STRING && member->type != IS_UNICODE) { tmp_member = *member; zval_copy_ctor(&tmp_member); - convert_to_text(&tmp_member); + convert_to_unicode(&tmp_member); member = &tmp_member; } @@ -404,7 +404,7 @@ static int dom_property_exists(zval *object, zval *member, int check_empty TSRML if (member->type != IS_STRING && member->type != IS_UNICODE) { tmp_member = *member; zval_copy_ctor(&tmp_member); - convert_to_text(&tmp_member); + convert_to_unicode(&tmp_member); member = &tmp_member; } @@ -602,19 +602,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_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, ce.name_length + 1, &dom_domstringlist_prop_handlers, sizeof(dom_domstringlist_prop_handlers), NULL); + zend_u_hash_add(&classes, IS_UNICODE, 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_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, ce.name_length + 1, &dom_namelist_prop_handlers, sizeof(dom_namelist_prop_handlers), NULL); + zend_u_hash_add(&classes, IS_UNICODE, 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_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, ce.name_length + 1, &dom_domimplementationlist_prop_handlers, sizeof(dom_domimplementationlist_prop_handlers), NULL); + zend_u_hash_add(&classes, IS_UNICODE, 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); @@ -638,7 +638,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_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, ce.name_length + 1, &dom_node_prop_handlers, sizeof(dom_node_prop_handlers), NULL); + zend_u_hash_add(&classes, IS_UNICODE, 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); @@ -651,12 +651,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_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); + zend_u_hash_add(&classes, IS_UNICODE, 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_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, ce.name_length + 1, &dom_document_fragment_prop_handlers, sizeof(dom_node_prop_handlers), NULL); + zend_u_hash_add(&classes, IS_UNICODE, 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); @@ -681,7 +681,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_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, ce.name_length + 1, &dom_document_prop_handlers, sizeof(dom_document_prop_handlers), NULL); + zend_u_hash_add(&classes, IS_UNICODE, 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; @@ -690,7 +690,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_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, ce.name_length + 1, &dom_nodelist_prop_handlers, sizeof(dom_nodelist_prop_handlers), NULL); + zend_u_hash_add(&classes, IS_UNICODE, 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; @@ -699,7 +699,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_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, ce.name_length + 1, &dom_namednodemap_prop_handlers, sizeof(dom_namednodemap_prop_handlers), NULL); + zend_u_hash_add(&classes, IS_UNICODE, 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); @@ -707,7 +707,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_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, ce.name_length + 1, &dom_characterdata_prop_handlers, sizeof(dom_characterdata_prop_handlers), NULL); + zend_u_hash_add(&classes, IS_UNICODE, 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); @@ -718,7 +718,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_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, ce.name_length + 1, &dom_attr_prop_handlers, sizeof(dom_attr_prop_handlers), NULL); + zend_u_hash_add(&classes, IS_UNICODE, 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); @@ -726,26 +726,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_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, ce.name_length + 1, &dom_element_prop_handlers, sizeof(dom_element_prop_handlers), NULL); + zend_u_hash_add(&classes, IS_UNICODE, 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_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, ce.name_length + 1, &dom_text_prop_handlers, sizeof(dom_text_prop_handlers), NULL); + zend_u_hash_add(&classes, IS_UNICODE, 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_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, ce.name_length + 1, &dom_comment_prop_handlers, sizeof(dom_comment_prop_handlers), NULL); + zend_u_hash_add(&classes, IS_UNICODE, 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_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, ce.name_length + 1, &dom_typeinfo_prop_handlers, sizeof(dom_typeinfo_prop_handlers), NULL); + zend_u_hash_add(&classes, IS_UNICODE, 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); @@ -757,7 +757,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_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, ce.name_length + 1, &dom_domerror_prop_handlers, sizeof(dom_domerror_prop_handlers), NULL); + zend_u_hash_add(&classes, IS_UNICODE, 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); @@ -768,13 +768,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_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, ce.name_length + 1, &dom_domlocator_prop_handlers, sizeof(dom_domlocator_prop_handlers), NULL); + zend_u_hash_add(&classes, IS_UNICODE, 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_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, ce.name_length + 1, &dom_cdata_prop_handlers, sizeof(dom_documenttype_prop_handlers), NULL); + zend_u_hash_add(&classes, IS_UNICODE, 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); @@ -786,7 +786,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_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, ce.name_length + 1, &dom_documenttype_prop_handlers, sizeof(dom_documenttype_prop_handlers), NULL); + zend_u_hash_add(&classes, IS_UNICODE, 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); @@ -797,7 +797,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_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, ce.name_length + 1, &dom_notation_prop_handlers, sizeof(dom_notation_prop_handlers), NULL); + zend_u_hash_add(&classes, IS_UNICODE, 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); @@ -810,12 +810,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_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, ce.name_length + 1, &dom_entity_prop_handlers, sizeof(dom_entity_prop_handlers), NULL); + zend_u_hash_add(&classes, IS_UNICODE, 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_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, ce.name_length + 1, &dom_entity_reference_prop_handlers, sizeof(dom_entity_prop_handlers), NULL); + zend_u_hash_add(&classes, IS_UNICODE, 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); @@ -823,7 +823,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_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, ce.name_length + 1, &dom_processinginstruction_prop_handlers, sizeof(dom_processinginstruction_prop_handlers), NULL); + zend_u_hash_add(&classes, IS_UNICODE, 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); @@ -834,7 +834,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_u_hash_add(&classes, ZEND_STR_TYPE, ce.name, ce.name_length + 1, &dom_xpath_prop_handlers, sizeof(dom_xpath_prop_handlers), NULL); + zend_u_hash_add(&classes, IS_UNICODE, 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); @@ -1062,7 +1062,7 @@ static dom_object* dom_objects_set_class(zend_class_entry *class_type, zend_bool base_class = base_class->parent; } - zend_u_hash_find(&classes, UG(unicode)?IS_UNICODE:IS_STRING, base_class->name, base_class->name_length + 1, (void **) &intern->prop_handler); + zend_u_hash_find(&classes, IS_UNICODE, 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) { diff --git a/ext/gettext/gettext.c b/ext/gettext/gettext.c index 11f6982301..90f9235560 100644 --- a/ext/gettext/gettext.c +++ b/ext/gettext/gettext.c @@ -159,9 +159,8 @@ PHP_MINFO_FUNCTION(php_gettext) #define RETVAL_FS_STRING(s, f) \ RETVAL_STRING((s), (f)); \ - if (UG(unicode)) { \ - zval_string_to_unicode_ex(return_value, ZEND_U_CONVERTER(UG(filesystem_encoding_conv)) TSRMLS_CC); \ - } + zval_string_to_unicode_ex(return_value, ZEND_U_CONVERTER(UG(filesystem_encoding_conv)) TSRMLS_CC); + #define RETURN_FS_STRING(s, f) \ RETVAL_FS_STRING((s), (f)); \ return; diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index cc501824b1..3a399c3992 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -342,12 +342,10 @@ static int php_iconv_output_handler(void **nothing, php_output_context *output_c return FAILURE; } - if (UG(unicode)) { - output_encoding = INI_STR("unicode.output_encoding"); - if (output_encoding && *output_encoding && ucnv_compareNames(output_encoding, ICONVG(internal_encoding))) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "unicode.output_encoding differs from iconv.internal_encoding (%s, %s)", output_encoding, ICONVG(internal_encoding)); - zend_alter_ini_entry(ZEND_STRS("iconv.internal_encoding"), output_encoding, strlen(output_encoding), PHP_INI_USER, PHP_INI_STAGE_RUNTIME); - } + output_encoding = INI_STR("unicode.output_encoding"); + if (output_encoding && *output_encoding && ucnv_compareNames(output_encoding, ICONVG(internal_encoding))) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "unicode.output_encoding differs from iconv.internal_encoding (%s, %s)", output_encoding, ICONVG(internal_encoding)); + zend_alter_ini_entry(ZEND_STRS("iconv.internal_encoding"), output_encoding, strlen(output_encoding), PHP_INI_USER, PHP_INI_STAGE_RUNTIME); } if (SG(sapi_headers).mimetype && !strncasecmp(SG(sapi_headers).mimetype, "text/", 5)) { diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index 6640b4ed1a..74d98783b8 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -856,7 +856,7 @@ int php_libxml_register_export(zend_class_entry *ce, php_libxml_export_node expo php_libxml_initialize(); export_hnd.export_func = export_function; - return zend_u_hash_add(&php_libxml_exports, ZEND_STR_TYPE, ce->name, ce->name_length + 1, &export_hnd, sizeof(export_hnd), NULL); + return zend_u_hash_add(&php_libxml_exports, IS_UNICODE, ce->name, ce->name_length + 1, &export_hnd, sizeof(export_hnd), NULL); } PHP_LIBXML_API xmlNodePtr php_libxml_import_node(zval *object TSRMLS_DC) @@ -870,7 +870,7 @@ PHP_LIBXML_API xmlNodePtr php_libxml_import_node(zval *object TSRMLS_DC) while (ce->parent != NULL) { ce = ce->parent; } - if (zend_u_hash_find(&php_libxml_exports, UG(unicode)?IS_UNICODE:IS_STRING, ce->name, ce->name_length + 1, (void **) &export_hnd) == SUCCESS) { + if (zend_u_hash_find(&php_libxml_exports, IS_UNICODE, ce->name, ce->name_length + 1, (void **) &export_hnd) == SUCCESS) { node = export_hnd->export_func(object TSRMLS_CC); } } diff --git a/ext/libxml/php_libxml.h b/ext/libxml/php_libxml.h index 60234483cd..a02cc54aff 100644 --- a/ext/libxml/php_libxml.h +++ b/ext/libxml/php_libxml.h @@ -103,17 +103,13 @@ PHP_LIBXML_API void php_libxml_shutdown(void); #define ZVAL_XML_STRING(z, s, flags) { \ UConverter *libxml_utf_conv = NULL; \ - if (UG(unicode)) { \ - libxml_utf_conv = UG(utf8_conv); \ - } \ + libxml_utf_conv = UG(utf8_conv); \ ZVAL_U_STRING(libxml_utf_conv, z, s, flags); \ } #define ZVAL_XML_STRING_LEN(z, s, l, flags) { \ UConverter *libxml_utf_conv = NULL; \ - if (UG(unicode)) { \ - libxml_utf_conv = UG(utf8_conv); \ - } \ + libxml_utf_conv = UG(utf8_conv); \ ZVAL_U_STRINGL(libxml_utf_conv, z, s, l, flags); \ } diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index 25e5e6a7db..50ccb9bcd2 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -1360,7 +1360,7 @@ sb4 php_oci_error(OCIError *err_p, sword status TSRMLS_DC) case OCI_SUCCESS_WITH_INFO: errcode = php_oci_fetch_errmsg(err_p, &errbuf TSRMLS_CC); if (errbuf) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCI_SUCCESS_WITH_INFO: %R", (UG(unicode) ? IS_UNICODE : IS_STRING), errbuf); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCI_SUCCESS_WITH_INFO: %R", IS_UNICODE, errbuf); efree(errbuf); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCI_SUCCESS_WITH_INFO: failed to fetch error message"); @@ -1375,7 +1375,7 @@ sb4 php_oci_error(OCIError *err_p, sword status TSRMLS_DC) case OCI_ERROR: errcode = php_oci_fetch_errmsg(err_p, &errbuf TSRMLS_CC); if (errbuf) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%R", (UG(unicode) ? IS_UNICODE : IS_STRING), errbuf); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%R", IS_UNICODE, errbuf); efree(errbuf); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to fetch error message"); @@ -1415,7 +1415,7 @@ sb4 php_oci_fetch_errmsg(OCIError *error_handle, text **error_buf TSRMLS_DC) if (error_code) { int err_buf_len; - if (UG(unicode) && error_handle == OCI_G(err)) { + if (error_handle == OCI_G(err)) { /* global err handle is not Unicode aware */ UChar *tmp_buf; int tmp_buf_len; @@ -1432,16 +1432,9 @@ sb4 php_oci_fetch_errmsg(OCIError *error_handle, text **error_buf TSRMLS_DC) efree(tmp_buf); } } else { - if (UG(unicode)) { - err_buf_len = u_strlen((UChar *)err_buf); - if (err_buf_len && err_buf[UBYTES(err_buf_len - 1)] == '\n') { /* UTODO */ - err_buf[UBYTES(err_buf_len - 1)] = '\0'; - } - } else { - err_buf_len = strlen((char *)err_buf); - if (err_buf_len && err_buf[err_buf_len - 1] == '\n') { - err_buf[err_buf_len - 1] = '\0'; - } + err_buf_len = u_strlen((UChar *)err_buf); + if (err_buf_len && err_buf[UBYTES(err_buf_len - 1)] == '\n') { /* UTODO */ + err_buf[UBYTES(err_buf_len - 1)] = '\0'; } if (err_buf_len && error_buf) { @@ -1463,11 +1456,7 @@ int php_oci_fetch_sqltext_offset(php_oci_statement *statement, zstr *sqltext, ub *sqltext = NULL_ZSTR; *error_offset = 0; - if (UG(unicode)) { - PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (dvoid *) &(sqltext->u), (ub4 *)&sqltext_len, OCI_ATTR_STATEMENT, statement->err)); - } else { - PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (dvoid *) &(sqltext->s), (ub4 *)&sqltext_len, OCI_ATTR_STATEMENT, statement->err)); - } + PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (dvoid *) &(sqltext->u), (ub4 *)&sqltext_len, OCI_ATTR_STATEMENT, statement->err)); if (statement->errcode != OCI_SUCCESS) { statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); @@ -1582,7 +1571,7 @@ php_oci_connection *php_oci_do_connect_ex(zstr username, int username_len, zstr */ if ((session_mode & (OCI_SYSOPER | OCI_SYSDBA | PHP_OCI_CRED_EXT)) || (new_password_len)) { use_spool = 0; - } else if (UG(unicode)) { + } else { /* Pre 10.1 session pool does not support unicode - bypass pool */ #ifndef HAVE_OCI_LOB_READ2 /* For finding 10.1+ client */ use_spool = 0; @@ -1595,7 +1584,7 @@ php_oci_connection *php_oci_do_connect_ex(zstr username, int username_len, zstr /* DRCP: connection_class is an attribute of a connection */ if (OCI_G(connection_class)){ - smart_str_appendl_ex(&hashed_details, OCI_G(connection_class), (ub4)UG(unicode) ? USTR_BYTES(type, u_strlen((UChar *)OCI_G(connection_class))) : strlen(OCI_G(connection_class)), 0); + smart_str_appendl_ex(&hashed_details, OCI_G(connection_class), (ub4)USTR_BYTES(type, u_strlen((UChar *)OCI_G(connection_class))), 0); } smart_str_appendl_ex(&hashed_details, "**", sizeof("**") - 1, 0); @@ -1611,31 +1600,8 @@ php_oci_connection *php_oci_do_connect_ex(zstr username, int username_len, zstr } smart_str_appendl_ex(&hashed_details, "**", sizeof("**") - 1, 0); - if (!UG(unicode)) { - if (charset.s && *charset.s) { - PHP_OCI_CALL_RETURN(charsetid, OCINlsCharSetNameToId, (OCI_G(env), (CONST oratext *)charset.s)); - if (!charsetid) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid character set name: %s", charset.s); - } else { - smart_str_append_unsigned_ex(&hashed_details, charsetid, 0); - } - } - - /* use NLS_LANG if no or invalid charset specified */ - if (!charsetid) { - size_t rsize = 0; - sword result; - - PHP_OCI_CALL_RETURN(result, OCINlsEnvironmentVariableGet, (&charsetid_nls_lang, 0, OCI_NLS_CHARSET_ID, 0, &rsize)); - if (result != OCI_SUCCESS) { - charsetid_nls_lang = 0; - } - smart_str_append_unsigned_ex(&hashed_details, charsetid_nls_lang, 0); - } - } else { - charsetid = OCI_UTF16ID; - smart_str_append_unsigned_ex(&hashed_details, charsetid, 0); - } + charsetid = OCI_UTF16ID; + smart_str_append_unsigned_ex(&hashed_details, charsetid, 0); timestamp = time(NULL); @@ -2196,11 +2162,7 @@ int php_oci_server_get_version(php_oci_connection *connection, zstr *version TSR return 1; } - if (UG(unicode)) { - version->u = eustrdup((UChar *)version_buff); - } else { - version->s = estrdup(version_buff); - } + version->u = eustrdup((UChar *)version_buff); return 0; } /* }}} */ @@ -2385,7 +2347,7 @@ void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_arg if (fetch_mode & PHP_OCI_NUM) { Z_ADDREF_P(element); } - add_u_assoc_zval(return_value, (UG(unicode) ? IS_UNICODE : IS_STRING), column->name, element); + add_u_assoc_zval(return_value, IS_UNICODE, column->name, element); } } else { @@ -2393,7 +2355,7 @@ void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_arg add_index_null(return_value, i); } if (fetch_mode & PHP_OCI_ASSOC) { - add_u_assoc_null(return_value, (UG(unicode) ? IS_UNICODE : IS_STRING), column->name); + add_u_assoc_null(return_value, IS_UNICODE, column->name); } } } @@ -2828,7 +2790,7 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool /* Set the Connection class and purity if OCI client version >= 11g */ #if (OCI_MAJOR_VERSION > 10) - PHP_OCI_CALL_RETURN(OCI_G(errcode),OCIAttrSet, ((dvoid *) connection->authinfo,(ub4) OCI_HTYPE_SESSION, (dvoid *) OCI_G(connection_class), (ub4)UG(unicode) ? USTR_BYTES(type, u_strlen((UChar *)OCI_G(connection_class))) : strlen(OCI_G(connection_class)), (ub4)OCI_ATTR_CONNECTION_CLASS, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode),OCIAttrSet, ((dvoid *) connection->authinfo,(ub4) OCI_HTYPE_SESSION, (dvoid *) OCI_G(connection_class), (ub4)USTR_BYTES(type, u_strlen((UChar *)OCI_G(connection_class))), (ub4)OCI_ATTR_CONNECTION_CLASS, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); diff --git a/ext/oci8/oci8_collection.c b/ext/oci8/oci8_collection.c index d7c07595d6..5b3c3bac66 100644 --- a/ext/oci8/oci8_collection.c +++ b/ext/oci8/oci8_collection.c @@ -344,11 +344,7 @@ int php_oci_collection_append_number(php_oci_collection *collection, zstr number OCINumber oci_number; php_oci_connection *connection = collection->connection; - if (UG(unicode)) { - element_double = zend_u_strtod(number.u, NULL); - } else { - element_double = zend_strtod(number.s, NULL); - } + element_double = zend_u_strtod(number.u, NULL); PHP_OCI_CALL_RETURN(connection->errcode, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number)); @@ -507,13 +503,8 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z return 1; } - if (UG(unicode)) { - ZVAL_UNICODEL(*result_element, (UChar *)buff, TEXT_CHARS(buff_len), 1); - /* Z_UNIVAL_P(*result_element)[buff_len] = 0; XXX */ - } else { - ZVAL_STRINGL(*result_element, (char *)buff, buff_len, 1); - Z_STRVAL_P(*result_element)[buff_len] = '\0'; - } + ZVAL_UNICODEL(*result_element, (UChar *)buff, TEXT_CHARS(buff_len), 1); + /* Z_UNIVAL_P(*result_element)[buff_len] = 0; XXX */ return 0; break; @@ -529,11 +520,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z if (str) { PHP_OCI_CALL_RETURN(str_len, OCIStringSize, (connection->env, oci_string)); - if (UG(unicode)) { - ZVAL_UNICODEL(*result_element, (UChar *)str, TEXT_CHARS(str_len), 1); - } else { - ZVAL_STRINGL(*result_element, (char *)str, str_len, 1); - } + ZVAL_UNICODEL(*result_element, (UChar *)str, TEXT_CHARS(str_len), 1); } return 0; } @@ -642,11 +629,7 @@ int php_oci_collection_element_set_number(php_oci_collection *collection, long i OCINumber oci_number; php_oci_connection *connection = collection->connection; - if (UG(unicode)) { - element_double = zend_u_strtod(number.u, NULL); - } else { - element_double = zend_strtod(number.s, NULL); - } + element_double = zend_u_strtod(number.u, NULL); PHP_OCI_CALL_RETURN(connection->errcode, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number)); diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c index 8b3d761642..44bacf19ba 100644 --- a/ext/oci8/oci8_interface.c +++ b/ext/oci8/oci8_interface.c @@ -1439,7 +1439,7 @@ PHP_FUNCTION(oci_fetch_all) if (flags & PHP_OCI_NUM) { zend_hash_next_index_insert(Z_ARRVAL_P(row), &element, sizeof(zval*), NULL); } else { /* default to ASSOC */ - zend_u_symtable_update(Z_ARRVAL_P(row), (UG(unicode) ? IS_UNICODE : IS_STRING), columns[ i ]->name, columns[ i ]->name_len+1, &element, sizeof(zval*), NULL); + zend_u_symtable_update(Z_ARRVAL_P(row), IS_UNICODE, columns[ i ]->name, columns[ i ]->name_len+1, &element, sizeof(zval*), NULL); } } @@ -1471,7 +1471,7 @@ PHP_FUNCTION(oci_fetch_all) MAKE_STD_ZVAL(tmp); array_init(tmp); - zend_u_symtable_update(Z_ARRVAL_P(array), (UG(unicode) ? IS_UNICODE : IS_STRING), columns[ i ]->name, columns[ i ]->name_len+1, (void *) &tmp, sizeof(zval*), (void **) &(outarrs[ i ])); + zend_u_symtable_update(Z_ARRVAL_P(array), IS_UNICODE, columns[ i ]->name, columns[ i ]->name_len+1, (void *) &tmp, sizeof(zval*), (void **) &(outarrs[ i ])); } } diff --git a/ext/oci8/oci8_lob.c b/ext/oci8/oci8_lob.c index c76b1ad947..cf6e29e716 100644 --- a/ext/oci8/oci8_lob.c +++ b/ext/oci8/oci8_lob.c @@ -172,9 +172,7 @@ sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, ub4 len, ub1 piece) memcpy(*(ctx->lob_data) + *(ctx->lob_len), bufxp, (size_t) lenp); *(ctx->lob_len) += lenp; - if (UG(unicode)) { - *(*(ctx->lob_data) + *(ctx->lob_len) + 1) = 0; - } + *(*(ctx->lob_data) + *(ctx->lob_len) + 1) = 0; *(*(ctx->lob_data) + *(ctx->lob_len)) = 0; return OCI_CONTINUE; diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c index eb195c8f86..630361fa87 100644 --- a/ext/oci8/oci8_statement.c +++ b/ext/oci8/oci8_statement.c @@ -283,9 +283,7 @@ php_oci_out_column *php_oci_statement_get_column(php_oci_statement *statement, l if (column == NULL) { continue; } else if ((int) column->name_len == column_name_len) { - if (!UG(unicode) && !strncmp(column->name.s, column_name.s, column_name_len)) { - return column; - } else if (UG(unicode) && !u_strncmp(column->name.u, column_name.u, column_name_len)) { + if (!u_strncmp(column->name.u, column_name.u, column_name_len)) { return column; } } @@ -556,12 +554,8 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) } PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); - if (UG(unicode)) { - outcol->name_len = TEXT_CHARS(outcol->name_len); - outcol->name.u = eustrndup((UChar*) colname, outcol->name_len); - } else { - outcol->name.s = estrndup((char*) colname, outcol->name_len); - } + outcol->name_len = TEXT_CHARS(outcol->name_len); + outcol->name.u = eustrndup((UChar*) colname, outcol->name_len); /* find a user-setted define */ if (statement->defines) { @@ -894,11 +888,7 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC) ub2 curr_element_length = TEXT_CHARS(bind->array.element_lengths[i]); if ((i < bind->array.old_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) { zval_dtor(*entry); - if (UG(unicode)) { - tmp.u = ((UChar *)bind->array.elements)+TEXT_CHARS(i*bind->array.max_length); - } else { - tmp.s = (char *)(((text *)bind->array.elements)+(i*bind->array.max_length)); - } + tmp.u = ((UChar *)bind->array.elements)+TEXT_CHARS(i*bind->array.max_length); ZVAL_TEXTL(*entry, tmp, curr_element_length, 1); zend_hash_move_forward(hash); @@ -989,7 +979,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, zstr name, int name_len, case SQLT_AFC: case SQLT_CHR: /* SQLT_CHR is the default value when type was not specified */ if (Z_TYPE_P(var) != IS_NULL) { - convert_to_text(var); + convert_to_unicode(var); } if (maxlength == -1) { switch (Z_TYPE_P(var)) { @@ -1148,15 +1138,10 @@ sb4 php_oci_bind_in_callback( *indpp = (dvoid *)&phpbind->indicator; } else if ((phpbind->descriptor == 0) && (phpbind->statement == 0)) { /* "normal string bind */ - convert_to_text(val); + convert_to_unicode(val); - if (UG(unicode)) { - *bufpp = Z_UNIVAL_P(val).v; - *alenp = UBYTES(Z_UNILEN_P(val)); - } else { - *bufpp = Z_STRVAL_P(val); - *alenp = Z_STRLEN_P(val); - } + *bufpp = Z_UNIVAL_P(val).v; + *alenp = UBYTES(Z_UNILEN_P(val)); *indpp = (dvoid *)&phpbind->indicator; } else if (phpbind->statement != 0) { /* RSET */ @@ -1236,34 +1221,18 @@ sb4 php_oci_bind_out_callback( *indpp = &phpbind->indicator; retval = OCI_CONTINUE; } else { - if (UG(unicode)) { - convert_to_unicode(val); - zval_dtor(val); - - Z_UNILEN_P(val) = PHP_OCI_PIECE_SIZE; /* 64K-1 is max XXX */ - Z_UNIVAL_P(val).v = ecalloc(1, UBYTES(Z_UNILEN_P(phpbind->zval) + 1)); - - *alenpp = (ub4*) &Z_UNILEN_P(phpbind->zval); - *bufpp = Z_UNIVAL_P(phpbind->zval).v; - *piecep = OCI_ONE_PIECE; - *rcodepp = &phpbind->retcode; - *indpp = &phpbind->indicator; - retval = OCI_CONTINUE; - } else { - convert_to_string(val); - zval_dtor(val); + convert_to_unicode(val); + zval_dtor(val); - Z_STRLEN_P(val) = PHP_OCI_PIECE_SIZE; /* 64K-1 is max XXX */ - Z_STRVAL_P(val) = ecalloc(1, Z_STRLEN_P(phpbind->zval) + 1); + Z_UNILEN_P(val) = PHP_OCI_PIECE_SIZE; /* 64K-1 is max XXX */ + Z_UNIVAL_P(val).v = ecalloc(1, UBYTES(Z_UNILEN_P(phpbind->zval) + 1)); - /* XXX we assume that zend-zval len has 4 bytes */ - *alenpp = (ub4*) &Z_STRLEN_P(phpbind->zval); - *bufpp = Z_STRVAL_P(phpbind->zval); - *piecep = OCI_ONE_PIECE; - *rcodepp = &phpbind->retcode; - *indpp = &phpbind->indicator; - retval = OCI_CONTINUE; - } + *alenpp = (ub4*) &Z_UNILEN_P(phpbind->zval); + *bufpp = Z_UNIVAL_P(phpbind->zval).v; + *piecep = OCI_ONE_PIECE; + *rcodepp = &phpbind->retcode; + *indpp = &phpbind->indicator; + retval = OCI_CONTINUE; } return retval; } @@ -1460,7 +1429,7 @@ php_oci_bind *php_oci_bind_array_helper_string(zval* var, long max_table_length, if (maxlength == -1) { zend_hash_internal_pointer_reset(hash); while (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE) { - convert_to_text_ex(entry); + convert_to_unicode_ex(entry); if (Z_UNILEN_PP(entry) > maxlength) { maxlength = Z_UNILEN_PP(entry) + 1; } @@ -1469,13 +1438,9 @@ php_oci_bind *php_oci_bind_array_helper_string(zval* var, long max_table_length, } bind = emalloc(sizeof(php_oci_bind)); - if (UG(unicode)) { - bind->array.elements = (UChar *)safe_emalloc(max_table_length * (maxlength + 1), sizeof(UChar), 0); - memset(bind->array.elements, 0, max_table_length * sizeof(UChar) * (maxlength + 1)); - } else { - bind->array.elements = (text *)safe_emalloc(max_table_length * (maxlength + 1), sizeof(text), 0); - memset(bind->array.elements, 0, max_table_length * sizeof(text) * (maxlength + 1)); - } + bind->array.elements = (UChar *)safe_emalloc(max_table_length * (maxlength + 1), sizeof(UChar), 0); + memset(bind->array.elements, 0, max_table_length * sizeof(UChar) * (maxlength + 1)); + bind->array.current_length = zend_hash_num_elements(Z_ARRVAL_P(var)); bind->array.old_length = bind->array.current_length; bind->array.max_length = TEXT_BYTES(maxlength); @@ -1488,7 +1453,7 @@ php_oci_bind *php_oci_bind_array_helper_string(zval* var, long max_table_length, for (i = 0; i < bind->array.current_length; i++) { if (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE) { - convert_to_text_ex(entry); + convert_to_unicode_ex(entry); bind->array.element_lengths[i] = TEXT_BYTES(Z_UNILEN_PP(entry)); if (Z_UNILEN_PP(entry) == 0) { bind->array.indicators[i] = -1; @@ -1504,16 +1469,12 @@ php_oci_bind *php_oci_bind_array_helper_string(zval* var, long max_table_length, if ((i < bind->array.current_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) { int element_length; - convert_to_text_ex(entry); + convert_to_unicode_ex(entry); element_length = (maxlength > Z_UNILEN_PP(entry)) ? Z_UNILEN_PP(entry) : maxlength; - if (UG(unicode)) { - memcpy((UChar *)bind->array.elements + i*maxlength, Z_UNIVAL_PP(entry).u, TEXT_BYTES(element_length)); - ((UChar *)bind->array.elements)[i*maxlength + element_length] = '\0'; - } else { - memcpy((text *)bind->array.elements + i*maxlength, Z_UNIVAL_PP(entry).s, element_length); - ((text *)bind->array.elements)[i*maxlength + element_length] = '\0'; - } + memcpy((UChar *)bind->array.elements + i*maxlength, Z_UNIVAL_PP(entry).u, TEXT_BYTES(element_length)); + ((UChar *)bind->array.elements)[i*maxlength + element_length] = '\0'; + zend_hash_move_forward(hash); } else { break; @@ -1628,12 +1589,8 @@ php_oci_bind *php_oci_bind_array_helper_date(zval* var, long max_table_length, p } if ((i < bind->array.current_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) { - convert_to_text_ex(entry); - if (UG(unicode)) { - PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, (CONST text *)Z_UNIVAL_PP(entry).s, UBYTES(Z_UNILEN_PP(entry)), NULL, 0, NULL, 0, &oci_date)); - } else { - PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, (CONST text *)Z_STRVAL_PP(entry), Z_STRLEN_PP(entry), NULL, 0, NULL, 0, &oci_date)); - } + convert_to_unicode_ex(entry); + PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, (CONST text *)Z_UNIVAL_PP(entry).s, UBYTES(Z_UNILEN_PP(entry)), NULL, 0, NULL, 0, &oci_date)); if (connection->errcode != OCI_SUCCESS) { /* failed to convert string to date */ @@ -1649,13 +1606,9 @@ php_oci_bind *php_oci_bind_array_helper_date(zval* var, long max_table_length, p zend_hash_move_forward(hash); } else { - if (UG(unicode)) { - UChar *tmp = USTR_MAKE("01-JAN-00"); - PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, (CONST text *)tmp, UBYTES(sizeof("01-JAN-00")-1), NULL, 0, NULL, 0, &oci_date)); - efree(tmp); - } else { - PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, (CONST text *)"01-JAN-00", sizeof("01-JAN-00")-1, NULL, 0, NULL, 0, &oci_date)); - } + UChar *tmp = USTR_MAKE("01-JAN-00"); + PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, (CONST text *)tmp, UBYTES(sizeof("01-JAN-00")-1), NULL, 0, NULL, 0, &oci_date)); + efree(tmp); if (connection->errcode != OCI_SUCCESS) { /* failed to convert string to date */ diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 762e668abe..73d13c21ca 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -270,13 +270,11 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_uchar utype, char *r zend_hash_clean(&PCRE_G(pcre_cache)); } else { #if HAVE_SETLOCALE - if (!strcmp(pce->locale, locale) && UG(unicode) == pce->unicode_mode) { + if (!strcmp(pce->locale, locale)) { return pce; } #else - if (UG(unicode) == pce->unicode_mode) { - return pce; - } + return pce; #endif } } @@ -435,7 +433,6 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_uchar utype, char *r new_entry.extra = extra; new_entry.preg_options = poptions; new_entry.compile_options = coptions; - new_entry.unicode_mode = UG(unicode); #if HAVE_SETLOCALE new_entry.locale = pestrdup(locale, 1); new_entry.tables = tables; @@ -451,7 +448,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_uchar utype, char *r */ PHPAPI pcre* pcre_get_compiled_regex(char *regex, pcre_extra **extra, int *preg_options TSRMLS_DC) { - pcre_cache_entry * pce = pcre_get_compiled_regex_cache(ZEND_STR_TYPE, regex, strlen(regex) TSRMLS_CC); + pcre_cache_entry * pce = pcre_get_compiled_regex_cache(IS_UNICODE, regex, strlen(regex) TSRMLS_CC); if (extra) { *extra = pce ? pce->extra : NULL; @@ -468,7 +465,7 @@ PHPAPI pcre* pcre_get_compiled_regex(char *regex, pcre_extra **extra, int *preg_ */ PHPAPI pcre* pcre_get_compiled_regex_ex(char *regex, pcre_extra **extra, int *preg_options, int *compile_options TSRMLS_DC) { - pcre_cache_entry * pce = pcre_get_compiled_regex_cache(ZEND_STR_TYPE, regex, strlen(regex) TSRMLS_CC); + pcre_cache_entry * pce = pcre_get_compiled_regex_cache(IS_UNICODE, regex, strlen(regex) TSRMLS_CC); if (extra) { *extra = pce ? pce->extra : NULL; @@ -519,16 +516,12 @@ static inline void add_offset_pair(zval *result, zend_uchar utype, char *str, in if (name) { zval_add_ref(&match_pair); - if (UG(unicode)) { - UErrorCode status = U_ZERO_ERROR; - UChar *u = NULL; - int u_len; - zend_string_to_unicode_ex(UG(utf8_conv), &u, &u_len, name, strlen(name), &status); - zend_u_hash_update(Z_ARRVAL_P(result), IS_UNICODE, ZSTR(u), u_len+1, &match_pair, sizeof(zval *), NULL); - efree(u); - } else { - zend_hash_update(Z_ARRVAL_P(result), name, strlen(name)+1, &match_pair, sizeof(zval *), NULL); - } + UErrorCode status = U_ZERO_ERROR; + UChar *u = NULL; + int u_len; + zend_string_to_unicode_ex(UG(utf8_conv), &u, &u_len, name, strlen(name), &status); + zend_u_hash_update(Z_ARRVAL_P(result), IS_UNICODE, ZSTR(u), u_len+1, &match_pair, sizeof(zval *), NULL); + efree(u); } zend_hash_next_index_insert(Z_ARRVAL_P(result), &match_pair, sizeof(zval *), NULL); } @@ -749,14 +742,8 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, zend_uchar utype, char *s * arrays with empty strings. */ if (count < num_subpats) { - if (UG(unicode)) { - for (; i < num_subpats; i++) { - add_next_index_unicode(match_sets[i], EMPTY_STR, 1); - } - } else { - for (; i < num_subpats; i++) { - add_next_index_string(match_sets[i], "", 1); - } + for (; i < num_subpats; i++) { + add_next_index_unicode(match_sets[i], EMPTY_STR, 1); } } } else { @@ -854,18 +841,12 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, zend_uchar utype, char *s int u_len; for (i = 0; i < num_subpats; i++) { if (subpat_names[i]) { - if (UG(unicode)) { - zend_string_to_unicode_ex(UG(utf8_conv), &u, &u_len, subpat_names[i], strlen(subpat_names[i]), &status); - zend_u_hash_update(Z_ARRVAL_P(subpats), IS_UNICODE, ZSTR(u), - u_len+1, &match_sets[i], sizeof(zval *), NULL); - Z_ADDREF_P(match_sets[i]); - efree(u); - status = U_ZERO_ERROR; - } else { - zend_hash_update(Z_ARRVAL_P(subpats), subpat_names[i], - strlen(subpat_names[i])+1, &match_sets[i], sizeof(zval *), NULL); - Z_ADDREF_P(match_sets[i]); - } + zend_string_to_unicode_ex(UG(utf8_conv), &u, &u_len, subpat_names[i], strlen(subpat_names[i]), &status); + zend_u_hash_update(Z_ARRVAL_P(subpats), IS_UNICODE, ZSTR(u), + u_len+1, &match_sets[i], sizeof(zval *), NULL); + Z_ADDREF_P(match_sets[i]); + efree(u); + status = U_ZERO_ERROR; } zend_hash_next_index_insert(Z_ARRVAL_P(subpats), &match_sets[i], sizeof(zval *), NULL); } @@ -1492,7 +1473,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl switch (zend_hash_get_current_key_ex(Z_ARRVAL_P(subject), &string_key, &string_key_len, &num_key, 0, NULL)) { case HASH_KEY_IS_UNICODE: - if (utype == IS_UNICODE || (UG(unicode) && utype != IS_STRING)) { + if (utype == IS_UNICODE || utype != IS_STRING) { add_u_assoc_utf8_stringl_ex(return_value, IS_UNICODE, string_key, string_key_len, result, result_len, ZSTR_AUTOFREE); } else { add_u_assoc_stringl_ex(return_value, IS_UNICODE, string_key, string_key_len, result, result_len, 0); @@ -1500,7 +1481,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl break; case HASH_KEY_IS_STRING: - if (utype == IS_UNICODE || (UG(unicode) && utype != IS_STRING)) { + if (utype == IS_UNICODE || utype != IS_STRING) { add_u_assoc_utf8_stringl_ex(return_value, IS_STRING, string_key, string_key_len, result, result_len, ZSTR_AUTOFREE); } else { add_u_assoc_stringl_ex(return_value, IS_STRING, string_key, string_key_len, result, result_len, 0); @@ -1508,7 +1489,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl break; case HASH_KEY_IS_LONG: - if (utype == IS_UNICODE || (UG(unicode) && utype != IS_STRING)) { + if (utype == IS_UNICODE || utype != IS_STRING) { add_index_utf8_stringl(return_value, num_key, result, result_len, ZSTR_AUTOFREE); } else { add_index_stringl(return_value, num_key, result, result_len, 0); @@ -1527,7 +1508,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl old_replace_count = replace_count; if ((result = php_replace_in_subject(regex, replace, &subject, &result_len, limit, is_callable_replace, &replace_count TSRMLS_CC)) != NULL) { if (!is_filter || replace_count > old_replace_count) { - if (utype == IS_UNICODE || (UG(unicode) && utype != IS_STRING)) { + if (utype == IS_UNICODE || utype != IS_STRING) { RETVAL_UTF8_STRINGL(result, result_len, ZSTR_AUTOFREE); } else { RETVAL_STRINGL(result, result_len, 0); @@ -1818,11 +1799,7 @@ static PHP_FUNCTION(preg_quote) } if (delim && *delim) { - if (UG(unicode)) { - U8_GET((unsigned char*)delim, 0, 0, delim_len, delim_char); - } else { - delim_char = (UChar32)delim[0]; - } + U8_GET((unsigned char*)delim, 0, 0, delim_len, delim_char); quote_delim = 1; } @@ -1831,7 +1808,7 @@ static PHP_FUNCTION(preg_quote) sequence is 4 bytes, so the multiplier is (4+1). In non-Unicode mode, we have to assume that any character can be '\0', which needs 4 chars to be escaped. */ - out_str = safe_emalloc(UG(unicode)?5:4, in_str_len, 1); + out_str = safe_emalloc(5, in_str_len, 1); /* Go through the string and quote necessary characters */ for(p = in_str, q = out_str; p != in_str_end; p++) { diff --git a/ext/pcre/php_pcre.h b/ext/pcre/php_pcre.h index a244aed637..8dd1c4869e 100644 --- a/ext/pcre/php_pcre.h +++ b/ext/pcre/php_pcre.h @@ -50,7 +50,6 @@ typedef struct { #endif int compile_options; int refcount; - zend_bool unicode_mode; } pcre_cache_entry; PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_uchar utype, char *regex, int regex_len TSRMLS_DC); diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 6bf0583849..1dc4f133d2 100755 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -452,11 +452,7 @@ static void pdo_stmt_construct(pdo_stmt_t *stmt, zval *object, zend_class_entry ZVAL_ASCII_STRINGL(&z_key, "queryString", sizeof("queryString")-1, 0); std_object_handlers.write_property(object, &z_key, query_string TSRMLS_CC); zval_ptr_dtor(&query_string); -#ifdef IS_UNICODE - if (UG(unicode)) { - zval_dtor(&z_key); - } -#endif + zval_dtor(&z_key); if (dbstmt_ce->constructor) { zend_fcall_info fci; @@ -1336,9 +1332,7 @@ static union _zend_function *dbh_method_get( zval *object = *object_pp; #endif pdo_dbh_t *dbh = zend_object_store_get_object(object TSRMLS_CC); -#ifdef IS_UNICODE - zend_uchar ztype = UG(unicode) ? IS_UNICODE : IS_STRING; -#endif + zend_uchar ztype = IS_UNICODE; lc_method_name = zend_u_str_tolower_dup(ztype, method_name, method_len); diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 92e705ca3b..5b02af585b 100755 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -2308,9 +2308,7 @@ static union _zend_function *dbstmt_method_get( #if PHP_API_VERSION >= 20041225 zval *object = *object_pp; #endif -#ifdef IS_UNICODE - zend_uchar ztype = UG(unicode) ? IS_UNICODE : IS_STRING; -#endif + zend_uchar ztype = IS_UNICODE; lc_method_name = zend_u_str_tolower_dup(ztype, method_name, method_len); @@ -2720,9 +2718,7 @@ static union _zend_function *row_method_get( { zend_function *fbc; zstr lc_method_name; -#ifdef IS_UNICODE - zend_uchar ztype = UG(unicode) ? IS_UNICODE : IS_STRING; -#endif + zend_uchar ztype = IS_UNICODE; lc_method_name = zend_u_str_tolower_dup(ztype, method_name, method_len); @@ -2768,7 +2764,7 @@ static int row_get_classname(const zval *object, zstr *class_name, zend_uint *c if (parent) { return FAILURE; } else { - *class_name = ezstrndup(ZEND_STR_TYPE, ZSTR("PDORow"), sizeof("PDORow") - 1); + *class_name = ezstrndup(IS_UNICODE, ZSTR("PDORow"), sizeof("PDORow") - 1); *class_name_len = sizeof("PDORow")-1; return SUCCESS; } diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 0812a17f03..c555f0725c 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -244,11 +244,7 @@ static zend_function *_copy_function(zend_function *fptr TSRMLS_DC) /* {{{ */ zend_function *copy_fptr; copy_fptr = emalloc(sizeof(zend_function)); memcpy(copy_fptr, fptr, sizeof(zend_function)); - if (UG(unicode)) { - copy_fptr->internal_function.function_name.u = eustrdup(fptr->internal_function.function_name.u); - } else { - copy_fptr->internal_function.function_name.s = estrdup(fptr->internal_function.function_name.s); - } + copy_fptr->internal_function.function_name.u = eustrdup(fptr->internal_function.function_name.u); return copy_fptr; } else { /* no copy needed */ @@ -543,8 +539,8 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in zend_uchar prop_type; ulong index; - if ((prop_type = zend_hash_get_current_key_ex(properties, &prop_name, &prop_name_size, &index, 0, &pos)) == (UG(unicode)?HASH_KEY_IS_UNICODE:HASH_KEY_IS_STRING)) { - if (prop_name_size && (UG(unicode)?prop_name.u[0]:prop_name.s[0])) { /* skip all private and protected properties */ + if ((prop_type = zend_hash_get_current_key_ex(properties, &prop_name, &prop_name_size, &index, 0, &pos)) == HASH_KEY_IS_UNICODE) { + if (prop_name_size && prop_name.u[0]) { /* skip all private and protected properties */ if (!zend_u_hash_exists(&ce->properties_info, prop_type, prop_name, prop_name_size)) { count++; _property_string(&dyn, NULL, prop_name, sub_indent.string TSRMLS_CC); @@ -579,21 +575,19 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in zstr key; uint key_len; ulong num_index; - uint lcname_len, len = UG(unicode)?u_strlen(mptr->common.function_name.u):strlen(mptr->common.function_name.s); - zstr lcname = zend_u_str_case_fold(ZEND_STR_TYPE, mptr->common.function_name, len, 1, &lcname_len); + uint lcname_len, len = u_strlen(mptr->common.function_name.u); + zstr lcname = zend_u_str_case_fold(IS_UNICODE, mptr->common.function_name, len, 1, &lcname_len); /* Do not display old-style inherited constructors */ if ((mptr->common.fn_flags & ZEND_ACC_CTOR) == 0 || mptr->common.scope == ce - || zend_hash_get_current_key_ex(&ce->function_table, &key, &key_len, &num_index, 0, &pos) != (UG(unicode)?HASH_KEY_IS_UNICODE:HASH_KEY_IS_STRING) - || (UG(unicode) - ? zend_u_binary_strcmp(key.u, key_len-1, lcname.u, lcname_len) == 0 - : zend_binary_strcmp(key.s, key_len-1, lcname.s, lcname_len) == 0)) + || zend_hash_get_current_key_ex(&ce->function_table, &key, &key_len, &num_index, 0, &pos) != HASH_KEY_IS_UNICODE + || zend_u_binary_strcmp(key.u, key_len-1, lcname.u, lcname_len) == 0) { zend_function *closure; /* see if this is a closure */ if (ce == zend_ce_closure && obj && (len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) - && ZEND_U_EQUAL(ZEND_STR_TYPE, lcname, len, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) + && ZEND_U_EQUAL(IS_UNICODE, lcname, len, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) && (closure = zend_get_closure_invoke_method(obj TSRMLS_CC)) != NULL) { mptr = closure; @@ -717,9 +711,7 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg } else if (Z_TYPE_P(zv) == IS_NULL) { string_write(str, "NULL", sizeof("NULL")-1); } else if (Z_TYPE_P(zv) == IS_STRING) { - if (UG(unicode)) { - string_write(str, "b'", sizeof("b")-1); - } + string_write(str, "b'", sizeof("b")-1); string_write(str, "'", sizeof("'")-1); string_write(str, Z_STRVAL_P(zv), MIN(Z_STRLEN_P(zv), 15)); if (Z_STRLEN_P(zv) > 15) { @@ -802,8 +794,8 @@ 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(ZEND_STR_TYPE, fptr->common.function_name, USTR_LEN(fptr->common.function_name), 1, &lc_name_len); - if (zend_u_hash_find(&fptr->common.scope->parent->function_table, ZEND_STR_TYPE, lc_name, lc_name_len + 1, (void**) &overwrites) == SUCCESS) { + lc_name = zend_u_str_case_fold(IS_UNICODE, fptr->common.function_name, USTR_LEN(fptr->common.function_name), 1, &lc_name_len); + if (zend_u_hash_find(&fptr->common.scope->parent->function_table, IS_UNICODE, 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); } @@ -940,7 +932,7 @@ static void _property_string(string *str, zend_property_info *prop, zstr sz_prop string_printf(str, "static "); } - zend_u_unmangle_property_name(UG(unicode)?IS_UNICODE:IS_STRING, prop->name, prop->name_length, &class_name, &prop_name); + zend_u_unmangle_property_name(IS_UNICODE, prop->name, prop->name_length, &class_name, &prop_name); string_printf(str, "$%v", prop_name); } @@ -1266,7 +1258,7 @@ static void reflection_property_factory(zend_class_entry *ce, zend_property_info zval *classname; property_reference *reference; zstr class_name, prop_name; - zend_uchar utype = UG(unicode) ? IS_UNICODE : IS_STRING; + zend_uchar utype = IS_UNICODE; zend_u_unmangle_property_name(utype, prop->name, prop->name_length, &class_name, &prop_name); @@ -1274,7 +1266,7 @@ static void reflection_property_factory(zend_class_entry *ce, zend_property_info /* we have to search the class hierarchy for this (implicit) public or protected property */ zend_class_entry *tmp_ce = ce, *store_ce = ce; zend_property_info *tmp_info = NULL; - int prop_name_len = UG(unicode) ? u_strlen(prop_name.u) : strlen(prop_name.s); + int prop_name_len = u_strlen(prop_name.u); 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; @@ -1726,7 +1718,7 @@ ZEND_METHOD(reflection_function, getDocComment) } GET_REFLECTION_OBJECT_PTR(fptr); if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.doc_comment.v) { - RETURN_ZSTRL(ZEND_STR_TYPE, fptr->op_array.doc_comment, fptr->op_array.doc_comment_len, 1); + RETURN_ZSTRL(IS_UNICODE, fptr->op_array.doc_comment, fptr->op_array.doc_comment_len, 1); } RETURN_FALSE; } @@ -2071,7 +2063,7 @@ ZEND_METHOD(reflection_parameter, __construct) if (Z_TYPE_PP(classref) == IS_OBJECT) { ce = Z_OBJCE_PP(classref); } else { - convert_to_text_ex(classref); + convert_to_unicode_ex(classref); if (zend_u_lookup_class(Z_TYPE_PP(classref), Z_UNIVAL_PP(classref), Z_UNILEN_PP(classref), &pce TSRMLS_CC) == FAILURE) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %R does not exist", Z_TYPE_PP(classref), Z_UNIVAL_PP(classref)); @@ -2080,11 +2072,11 @@ ZEND_METHOD(reflection_parameter, __construct) ce = *pce; } - convert_to_text_ex(method); + convert_to_unicode_ex(method); lcname = zend_u_str_case_fold(Z_TYPE_PP(method), Z_UNIVAL_PP(method), Z_UNILEN_PP(method), 1, &lcname_len); if (ce == zend_ce_closure && Z_TYPE_PP(classref) == IS_OBJECT && lcname_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1 - && ZEND_U_EQUAL(ZEND_STR_TYPE, lcname, lcname_len, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) + && ZEND_U_EQUAL(IS_UNICODE, lcname, lcname_len, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) && (fptr = zend_get_closure_invoke_method(*classref TSRMLS_CC)) != NULL) { /* do nothing, fptr is already set */ @@ -2134,7 +2126,7 @@ ZEND_METHOD(reflection_parameter, __construct) zend_uint i; position= -1; - convert_to_text_ex(parameter); + convert_to_unicode_ex(parameter); for (i = 0; i < fptr->common.num_args; i++) { if (Z_TYPE_PP(parameter) == IS_STRING && arg_info[i].name.s && strcmp(arg_info[i].name.s, Z_STRVAL_PP(parameter)) == 0) { position= i; @@ -2269,7 +2261,7 @@ ZEND_METHOD(reflection_parameter, getClass) * TODO: Think about moving these checks to the compiler or some sort of * lint-mode. */ - if (ZEND_U_EQUAL(ZEND_STR_TYPE, param->arg_info->class_name, param->arg_info->class_name_len, "self", sizeof("self")- 1)) { + if (ZEND_U_EQUAL(IS_UNICODE, param->arg_info->class_name, param->arg_info->class_name_len, "self", sizeof("self")- 1)) { ce = param->fptr->common.scope; if (!ce) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, @@ -2277,7 +2269,7 @@ ZEND_METHOD(reflection_parameter, getClass) return; } pce= &ce; - } else if (ZEND_U_EQUAL(ZEND_STR_TYPE, param->arg_info->class_name, param->arg_info->class_name_len, "parent", sizeof("parent")- 1)) { + } else if (ZEND_U_EQUAL(IS_UNICODE, param->arg_info->class_name, param->arg_info->class_name_len, "parent", sizeof("parent")- 1)) { ce = param->fptr->common.scope; if (!ce) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, @@ -2290,7 +2282,7 @@ ZEND_METHOD(reflection_parameter, getClass) return; } pce= &ce->parent; - } else if (zend_u_lookup_class(UG(unicode)?IS_UNICODE:IS_STRING, param->arg_info->class_name, param->arg_info->class_name_len, &pce TSRMLS_CC) == FAILURE) { + } else if (zend_u_lookup_class(IS_UNICODE, param->arg_info->class_name, param->arg_info->class_name_len, &pce TSRMLS_CC) == FAILURE) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %v does not exist", param->arg_info->class_name); return; @@ -2472,14 +2464,9 @@ ZEND_METHOD(reflection_method, __construct) zend_uchar type; if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "o", &classname) == SUCCESS) { - if (UG(unicode)) { - name_str.u = USTR_MAKE(ZEND_INVOKE_FUNC_NAME); - free_name_str = 1; - type = IS_UNICODE; - } else { - name_str.s = ZEND_INVOKE_FUNC_NAME; - type = IS_STRING; - } + name_str.u = USTR_MAKE(ZEND_INVOKE_FUNC_NAME); + free_name_str = 1; + type = IS_UNICODE; name_len = sizeof(ZEND_INVOKE_FUNC_NAME)-1; orig_obj = classname; } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "zt", &classname, &name_str, &name_len, &type) == FAILURE) { @@ -2563,7 +2550,7 @@ ZEND_METHOD(reflection_method, __construct) lcname = zend_u_str_case_fold(type, name_str, name_len, 1, &lcname_len); if (ce == zend_ce_closure && orig_obj && (lcname_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) - && ZEND_U_EQUAL(ZEND_STR_TYPE, lcname, lcname_len, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) + && ZEND_U_EQUAL(IS_UNICODE, lcname, lcname_len, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) && (mptr = zend_get_closure_invoke_method(orig_obj TSRMLS_CC)) != NULL) { /* do nothing, mptr already set */ @@ -3203,12 +3190,12 @@ ZEND_METHOD(reflection_class, getStaticProperties) zstr prop_name, class_name; int prop_name_len; - zend_u_unmangle_property_name(UG(unicode)?IS_UNICODE:IS_STRING, key, key_len-1, &class_name, &prop_name); - prop_name_len = UG(unicode) ? u_strlen(prop_name.u) : strlen(prop_name.s); + zend_u_unmangle_property_name(IS_UNICODE, key, key_len-1, &class_name, &prop_name); + prop_name_len = u_strlen(prop_name.u); zval_add_ref(value); - zend_u_hash_update(Z_ARRVAL_P(return_value), UG(unicode)?IS_UNICODE:IS_STRING, prop_name, prop_name_len+1, value, sizeof(zval *), NULL); + zend_u_hash_update(Z_ARRVAL_P(return_value), IS_UNICODE, prop_name, prop_name_len+1, value, sizeof(zval *), NULL); } zend_hash_move_forward_ex(CE_STATIC_MEMBERS(ce), &pos); } @@ -3321,9 +3308,9 @@ ZEND_METHOD(reflection_class, getDefaultProperties) zend_hash_get_current_key_ex(ht_list[i], &key, &key_len, &num_index, 0, &pos); zend_hash_move_forward_ex(ht_list[i], &pos); - zend_u_unmangle_property_name(UG(unicode)?IS_UNICODE:IS_STRING, key, key_len-1, &class_name, &prop_name); + zend_u_unmangle_property_name(IS_UNICODE, key, key_len-1, &class_name, &prop_name); if (class_name.s && class_name.s[0] != '*' - && (UG(unicode)?u_strcmp(class_name.u, ce->name.u):strcmp(class_name.s, ce->name.s))) + && u_strcmp(class_name.u, ce->name.u)) { /* filter privates from base classes */ continue; @@ -3335,7 +3322,7 @@ ZEND_METHOD(reflection_class, getDefaultProperties) zval_copy_ctor(prop_copy); INIT_PZVAL(prop_copy); - add_u_assoc_zval(return_value, ZEND_STR_TYPE, prop_name, prop_copy); + add_u_assoc_zval(return_value, IS_UNICODE, prop_name, prop_copy); } } } @@ -3467,7 +3454,7 @@ ZEND_METHOD(reflection_class, getDocComment) } GET_REFLECTION_OBJECT_PTR(ce); if (ce->type == ZEND_USER_CLASS && ce->doc_comment.v) { - RETURN_ZSTRL(ZEND_STR_TYPE, ce->doc_comment, ce->doc_comment_len, 1); + RETURN_ZSTRL(IS_UNICODE, ce->doc_comment, ce->doc_comment_len, 1); } RETURN_FALSE; } @@ -3541,7 +3528,7 @@ ZEND_METHOD(reflection_class, getMethod) GET_REFLECTION_OBJECT_PTR(ce); lc_name = zend_u_str_case_fold(type, name, name_len, 1, &lc_name_len); if (ce == zend_ce_closure && intern->obj && (lc_name_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) - && ZEND_U_EQUAL(ZEND_STR_TYPE, lc_name, lc_name_len, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) + && ZEND_U_EQUAL(IS_UNICODE, lc_name, lc_name_len, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) && (mptr = zend_get_closure_invoke_method(intern->obj TSRMLS_CC)) != NULL) { reflection_method_factory(ce, mptr, return_value TSRMLS_CC); @@ -3562,15 +3549,15 @@ ZEND_METHOD(reflection_class, getMethod) static void _addmethod(zend_function *mptr, zend_class_entry *ce, zval *retval, long filter, zval *obj TSRMLS_DC) { zval *method; - uint len = UG(unicode)?u_strlen(mptr->common.function_name.u):strlen(mptr->common.function_name.s); + uint len = u_strlen(mptr->common.function_name.u); zend_function *closure; if (mptr->common.fn_flags & filter) { unsigned int lc_name_len; - zstr lc_name = zend_u_str_case_fold(ZEND_STR_TYPE, mptr->common.function_name, len, 1, &lc_name_len); + zstr lc_name = zend_u_str_case_fold(IS_UNICODE, mptr->common.function_name, len, 1, &lc_name_len); ALLOC_ZVAL(method); if (ce == zend_ce_closure && obj && (lc_name_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) - && ZEND_U_EQUAL(ZEND_STR_TYPE, lc_name, lc_name_len, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) + && ZEND_U_EQUAL(IS_UNICODE, lc_name, lc_name_len, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) && (closure = zend_get_closure_invoke_method(obj TSRMLS_CC)) != NULL) { mptr = closure; @@ -4165,7 +4152,7 @@ ZEND_METHOD(reflection_class, getInterfaces) zval *interface; ALLOC_ZVAL(interface); zend_reflection_class_factory(ce->interfaces[i], interface TSRMLS_CC); - add_u_assoc_zval_ex(return_value, UG(unicode)?IS_UNICODE:IS_STRING, ce->interfaces[i]->name, ce->interfaces[i]->name_length + 1, interface); + add_u_assoc_zval_ex(return_value, IS_UNICODE, ce->interfaces[i]->name, ce->interfaces[i]->name_length + 1, interface); } } } @@ -4544,7 +4531,7 @@ ZEND_METHOD(reflection_property, __construct) MAKE_STD_ZVAL(propname); if (dynam_prop == 0) { - zend_u_unmangle_property_name(UG(unicode)?IS_UNICODE:IS_STRING, property_info->name, property_info->name_length, &class_name, &prop_name); + zend_u_unmangle_property_name(IS_UNICODE, property_info->name, property_info->name_length, &class_name, &prop_name); ZVAL_TEXT(propname, prop_name, 1); } else { ZVAL_TEXTL(propname, name_str, name_len, 1); @@ -4660,7 +4647,7 @@ ZEND_METHOD(reflection_property, getDefaultValue) property_reference *ref; HashTable *prop_defaults; zval **zdef, *zv; - zend_uchar utype = UG(unicode) ? IS_UNICODE : IS_STRING; + zend_uchar utype = IS_UNICODE; if (zend_parse_parameters_none() == FAILURE) { return; @@ -4708,7 +4695,7 @@ ZEND_METHOD(reflection_property, getValue) property_reference *ref; zval *object, name; zval **member= NULL, *member_p; - zend_uchar utype = UG(unicode)?IS_UNICODE:IS_STRING; + zend_uchar utype = IS_UNICODE; METHOD_NOTSTATIC(reflection_property_ptr); GET_REFLECTION_OBJECT_PTR(ref); @@ -4737,9 +4724,9 @@ ZEND_METHOD(reflection_property, getValue) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &object) == FAILURE) { return; } - zend_u_unmangle_property_name(UG(unicode)?IS_UNICODE:IS_STRING, ref->prop.name, ref->prop.name_length, &class_name, &prop_name); - prop_name_len = UG(unicode) ? u_strlen(prop_name.u) : strlen(prop_name.s); - member_p = zend_u_read_property(Z_OBJCE_P(object), object, UG(unicode)?IS_UNICODE:IS_STRING, prop_name, prop_name_len, 1 TSRMLS_CC); + zend_u_unmangle_property_name(IS_UNICODE, ref->prop.name, ref->prop.name_length, &class_name, &prop_name); + prop_name_len = u_strlen(prop_name.u); + member_p = zend_u_read_property(Z_OBJCE_P(object), object, IS_UNICODE, prop_name, prop_name_len, 1 TSRMLS_CC); *return_value= *member_p; zval_copy_ctor(return_value); INIT_PZVAL(return_value); @@ -4763,7 +4750,7 @@ ZEND_METHOD(reflection_property, setValue) int setter_done = 0; zval *tmp; HashTable *prop_table; - zend_uchar utype = UG(unicode)?IS_UNICODE:IS_STRING; + zend_uchar utype = IS_UNICODE; METHOD_NOTSTATIC(reflection_property_ptr); GET_REFLECTION_OBJECT_PTR(ref); @@ -4818,9 +4805,9 @@ ZEND_METHOD(reflection_property, setValue) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "oz", &object, &value) == FAILURE) { return; } - zend_u_unmangle_property_name(UG(unicode)?IS_UNICODE:IS_STRING, ref->prop.name, ref->prop.name_length, &class_name, &prop_name); - prop_name_len = UG(unicode) ? u_strlen(prop_name.u) : strlen(prop_name.s); - zend_u_update_property(Z_OBJCE_P(object), object, UG(unicode)?IS_UNICODE:IS_STRING, prop_name, prop_name_len, value TSRMLS_CC); + zend_u_unmangle_property_name(IS_UNICODE, ref->prop.name, ref->prop.name_length, &class_name, &prop_name); + prop_name_len = u_strlen(prop_name.u); + zend_u_update_property(Z_OBJCE_P(object), object, IS_UNICODE, prop_name, prop_name_len, value TSRMLS_CC); } } /* }}} */ @@ -4841,13 +4828,13 @@ ZEND_METHOD(reflection_property, getDeclaringClass) } GET_REFLECTION_OBJECT_PTR(ref); - if (zend_u_unmangle_property_name(UG(unicode)?IS_UNICODE:IS_STRING, ref->prop.name, ref->prop.name_length, &class_name, &prop_name) != SUCCESS) { + if (zend_u_unmangle_property_name(IS_UNICODE, ref->prop.name, ref->prop.name_length, &class_name, &prop_name) != SUCCESS) { RETURN_FALSE; } prop_name_len = USTR_LEN(prop_name); ce = tmp_ce = ref->ce; - while (tmp_ce && zend_u_hash_find(&tmp_ce->properties_info, UG(unicode)?IS_UNICODE:IS_STRING, prop_name, prop_name_len + 1, (void **) &tmp_info) == SUCCESS) { + while (tmp_ce && zend_u_hash_find(&tmp_ce->properties_info, IS_UNICODE, prop_name, prop_name_len + 1, (void **) &tmp_info) == SUCCESS) { if (tmp_info->flags & ZEND_ACC_PRIVATE || tmp_info->flags & ZEND_ACC_SHADOW) { /* it's a private property, so it can't be inherited */ break; @@ -4872,7 +4859,7 @@ ZEND_METHOD(reflection_property, getDocComment) } GET_REFLECTION_OBJECT_PTR(ref); if (ref->prop.doc_comment.v) { - RETURN_ZSTRL(ZEND_STR_TYPE, ref->prop.doc_comment, ref->prop.doc_comment_len, 1); + RETURN_ZSTRL(IS_UNICODE, ref->prop.doc_comment, ref->prop.doc_comment_len, 1); } RETURN_FALSE; } @@ -5038,7 +5025,7 @@ static int _addconstant(zend_constant *constant TSRMLS_DC, int num_args, va_list *const_val = constant->value; zval_copy_ctor(const_val); INIT_PZVAL(const_val); - add_u_assoc_zval_ex(retval, ZEND_STR_TYPE, constant->name, constant->name_len, const_val); + add_u_assoc_zval_ex(retval, IS_UNICODE, constant->name, constant->name_len, const_val); } return 0; } @@ -5106,7 +5093,7 @@ static int add_extension_class(zend_class_entry **pce TSRMLS_DC, int num_args, v if (add_reflection_class) { ALLOC_ZVAL(zclass); zend_reflection_class_factory(*pce, zclass TSRMLS_CC); - add_u_assoc_zval_ex(class_array, ZEND_STR_TYPE, (*pce)->name, (*pce)->name_length + 1, zclass); + add_u_assoc_zval_ex(class_array, IS_UNICODE, (*pce)->name, (*pce)->name_length + 1, zclass); } else { add_next_index_textl(class_array, (*pce)->name, (*pce)->name_length, 1); } diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c index 0a8bc4e098..ef68da609b 100644 --- a/ext/session/mod_files.c +++ b/ext/session/mod_files.c @@ -121,7 +121,7 @@ static char *ps_files_path_create(char *buf, size_t buflen, ps_files *data, cons n += key_len; buf[n] = '\0'; - if (UG(unicode) && UG(filesystem_encoding_conv) && + if (UG(filesystem_encoding_conv) && ucnv_getType(UG(filesystem_encoding_conv)) != UCNV_UTF8) { char *newbuf = NULL; int newlen; diff --git a/ext/session/session.c b/ext/session/session.c index 3e8235b329..d5e467ae43 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -2107,10 +2107,7 @@ static PHP_MINFO_FUNCTION(session) /* {{{ */ ************************ */ #define USTR_EQUAL(s1, len1, s2, len2) \ - ((len1) == (len2) && \ - (UG(unicode) ? \ - (zend_u_binary_strcmp((s1).u, (len1), (s2).u, (len2)) == 0) \ - : (zend_binary_strcmp((s1).s, (len1), (s2).s, (len2)) == 0))) + ((len1) == (len2) && zend_u_binary_strcmp((s1).u, (len1), (s2).u, (len2)) == 0) static inline void php_session_rfc1867_early_find_sid(php_session_rfc1867_progress *progress TSRMLS_DC) /* {{{ */ { diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index b535fba3b4..7345b8de67 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -551,9 +551,7 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool value = sxe_get_value(value TSRMLS_CC); INIT_PZVAL(value); new_value = 1; - if (UG(unicode)) { - convert_to_string_with_converter(value, UG(utf8_conv)); - } + convert_to_string_with_converter(value, UG(utf8_conv)); break; } /* break is missing intentionally */ @@ -1102,16 +1100,12 @@ static HashTable * sxe_get_prop_hash(zval *object, int is_debug TSRMLS_DC) /* {{ array_init(zattr); sxe_properties_add(rv, "@attributes", sizeof("@attributes"), zattr TSRMLS_CC); } - if (UG(unicode)) { - UErrorCode status = U_ZERO_ERROR; - zstr u_name; - int u_name_len; - zend_string_to_unicode_ex(UG(utf8_conv), &u_name.u, &u_name_len, (char*)attr->name, namelen, &status); - add_u_assoc_zval_ex(zattr, IS_UNICODE, u_name, u_name_len, value); - efree(u_name.u); - } else { - add_assoc_zval_ex(zattr, (char*)attr->name, namelen, value); - } + UErrorCode status = U_ZERO_ERROR; + zstr u_name; + int u_name_len; + zend_string_to_unicode_ex(UG(utf8_conv), &u_name.u, &u_name_len, (char*)attr->name, namelen, &status); + add_u_assoc_zval_ex(zattr, IS_UNICODE, u_name, u_name_len, value); + efree(u_name.u); } attr = attr->next; } @@ -1424,19 +1418,15 @@ static inline void sxe_add_namespace_name(zval *return_value, xmlNsPtr ns TSRMLS prefix_len = strlen(prefix) + 1; if (zend_ascii_hash_exists(Z_ARRVAL_P(return_value), prefix, prefix_len) == 0) { - if (UG(unicode)) { - UErrorCode status = U_ZERO_ERROR; - UChar *u_str; - zstr u_prefix; - int u_len, u_prefix_len; - int length = strlen((char*)ns->href); - zend_string_to_unicode_ex(UG(utf8_conv), &u_str, &u_len, (char*)ns->href, length, &status); - zend_string_to_unicode_ex(UG(utf8_conv), &u_prefix.u, &u_prefix_len, prefix, prefix_len, &status); - add_u_assoc_unicodel_ex(return_value, IS_UNICODE, u_prefix, u_prefix_len, u_str, u_len, 0); - efree(u_prefix.u); - } else { - add_assoc_string_ex(return_value, prefix, prefix_len, (char*)ns->href, 1); - } + UErrorCode status = U_ZERO_ERROR; + UChar *u_str; + zstr u_prefix; + int u_len, u_prefix_len; + int length = strlen((char*)ns->href); + zend_string_to_unicode_ex(UG(utf8_conv), &u_str, &u_len, (char*)ns->href, length, &status); + zend_string_to_unicode_ex(UG(utf8_conv), &u_prefix.u, &u_prefix_len, prefix, prefix_len, &status); + add_u_assoc_unicodel_ex(return_value, IS_UNICODE, u_prefix, u_prefix_len, u_str, u_len, 0); + efree(u_prefix.u); } } /* }}} */ @@ -1937,7 +1927,7 @@ static zval *sxe_get_value(zval *z TSRMLS_DC) /* {{{ */ MAKE_STD_ZVAL(retval); - if (sxe_object_cast(z, retval, UG(unicode)?IS_UNICODE:IS_STRING, NULL TSRMLS_CC)==FAILURE) { + if (sxe_object_cast(z, retval, IS_UNICODE, NULL TSRMLS_CC)==FAILURE) { zend_error(E_ERROR, "Unable to cast node to string"); /* FIXME: Should not be fatal */ } @@ -2407,20 +2397,13 @@ static int php_sxe_iterator_current_key(zend_object_iterator *iter, zstr *str_ke return HASH_KEY_NON_EXISTANT; } - if (UG(unicode)) { - UErrorCode status = U_ZERO_ERROR; - int u_len; + UErrorCode status = U_ZERO_ERROR; + int u_len; - namelen = xmlStrlen(curnode->name); - zend_string_to_unicode_ex(UG(utf8_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->s = estrndup((char *)curnode->name, namelen); - *str_key_len = namelen + 1; - return HASH_KEY_IS_STRING; - } + namelen = xmlStrlen(curnode->name); + zend_string_to_unicode_ex(UG(utf8_conv), &str_key->u, &u_len, (char*)curnode->name, namelen, &status); + *str_key_len = u_len + 1; + return HASH_KEY_IS_UNICODE; } /* }}} */ diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index d0d2e5fffd..923074674b 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -460,12 +460,7 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml for (zend_hash_internal_pointer_reset_ex(SOAP_GLOBAL(class_map), &pos); zend_hash_get_current_data_ex(SOAP_GLOBAL(class_map), (void **) &tmp, &pos) == SUCCESS; zend_hash_move_forward_ex(SOAP_GLOBAL(class_map), &pos)) { - if ((!UG(unicode) && - Z_TYPE_PP(tmp) == IS_STRING && - ce->name_length == Z_STRLEN_PP(tmp) && - zend_binary_strncasecmp(ce->name.s, ce->name_length, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), ce->name_length) == 0) || - (UG(unicode) && - Z_TYPE_PP(tmp) == IS_UNICODE && + if ((Z_TYPE_PP(tmp) == IS_UNICODE && ce->name_length == Z_USTRLEN_PP(tmp) && zend_u_binary_strncasecmp(ce->name.u, ce->name_length, Z_USTRVAL_PP(tmp), Z_USTRLEN_PP(tmp), ce->name_length) == 0)) { diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c index 087fc21b2b..efed060551 100644 --- a/ext/soap/php_http.c +++ b/ext/soap/php_http.c @@ -867,9 +867,7 @@ try_again: array_init(zcookie); MAKE_STD_ZVAL(zvalue); ZVAL_STRINGL(zvalue, eqpos + 1, cookie_len, 1); - if (UG(unicode)) { - zval_string_to_unicode_ex(zvalue, UG(utf8_conv) TSRMLS_CC); - } + zval_string_to_unicode_ex(zvalue, UG(utf8_conv) TSRMLS_CC); add_index_zval(zcookie, 0, zvalue); if (sempos != NULL) { diff --git a/ext/soap/php_packet_soap.c b/ext/soap/php_packet_soap.c index 8a039af4a1..0621298964 100644 --- a/ext/soap/php_packet_soap.c +++ b/ext/soap/php_packet_soap.c @@ -318,16 +318,12 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction tmp = master_to_zval(NULL, val); } } - if (UG(unicode)) { - UErrorCode status = U_ZERO_ERROR; - zstr u_name; - int u_name_len; - zend_string_to_unicode_ex(UG(utf8_conv), &u_name.u, &u_name_len, param->paramName, strlen(param->paramName), &status); - add_u_assoc_zval_ex(return_value, IS_UNICODE, u_name, u_name_len+1, tmp); - efree(u_name.u); - } else { - add_assoc_zval(return_value, param->paramName, tmp); - } + UErrorCode status = U_ZERO_ERROR; + zstr u_name; + int u_name_len; + zend_string_to_unicode_ex(UG(utf8_conv), &u_name.u, &u_name_len, param->paramName, strlen(param->paramName), &status); + add_u_assoc_zval_ex(return_value, IS_UNICODE, u_name, u_name_len+1, tmp); + efree(u_name.u); param_count++; @@ -349,38 +345,23 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction tmp = master_to_zval(NULL, val); if (val->name) { - if (UG(unicode)) { - UErrorCode status = U_ZERO_ERROR; - zstr u_name; - int u_name_len; - zend_string_to_unicode_ex(UG(utf8_conv), &u_name.u, &u_name_len, (char*)val->name, strlen((char*)val->name), &status); - if (zend_u_hash_find(Z_ARRVAL_P(return_value), IS_UNICODE, u_name, u_name_len+1, (void**)&arr) == SUCCESS) { - add_next_index_zval(*arr, tmp); - } else if (val->next && get_node(val->next, (char*)val->name)) { - zval *arr; - - MAKE_STD_ZVAL(arr); - array_init(arr); - add_next_index_zval(arr, tmp); - add_u_assoc_zval_ex(return_value, IS_UNICODE, u_name, u_name_len+1, arr); - } else { - add_u_assoc_zval_ex(return_value, IS_UNICODE, u_name, u_name_len+1, tmp); - } - efree(u_name.u); + UErrorCode status = U_ZERO_ERROR; + zstr u_name; + int u_name_len; + zend_string_to_unicode_ex(UG(utf8_conv), &u_name.u, &u_name_len, (char*)val->name, strlen((char*)val->name), &status); + if (zend_u_hash_find(Z_ARRVAL_P(return_value), IS_UNICODE, u_name, u_name_len+1, (void**)&arr) == SUCCESS) { + add_next_index_zval(*arr, tmp); + } else if (val->next && get_node(val->next, (char*)val->name)) { + zval *arr; + + MAKE_STD_ZVAL(arr); + array_init(arr); + add_next_index_zval(arr, tmp); + add_u_assoc_zval_ex(return_value, IS_UNICODE, u_name, u_name_len+1, arr); } else { - if (zend_hash_find(Z_ARRVAL_P(return_value), (char*)val->name, strlen((char*)val->name)+1, (void**)&arr) == SUCCESS) { - add_next_index_zval(*arr, tmp); - } else if (val->next && get_node(val->next, (char*)val->name)) { - zval *arr; - - MAKE_STD_ZVAL(arr); - array_init(arr); - add_next_index_zval(arr, tmp); - add_assoc_zval(return_value, (char*)val->name, arr); - } else { - add_assoc_zval(return_value, (char*)val->name, tmp); - } + add_u_assoc_zval_ex(return_value, IS_UNICODE, u_name, u_name_len+1, tmp); } + efree(u_name.u); } else { add_next_index_zval(return_value, tmp); } @@ -432,16 +413,12 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction smart_str_free(&key); } val = master_to_zval(enc, trav); - if (UG(unicode)) { - UErrorCode status = U_ZERO_ERROR; - zstr u_name; - int u_name_len; - zend_string_to_unicode_ex(UG(utf8_conv), &u_name.u, &u_name_len, (char*)trav->name, strlen((char*)trav->name), &status); - add_u_assoc_zval_ex(soap_headers, IS_UNICODE, u_name, u_name_len+1, val); - efree(u_name.u); - } else { - add_assoc_zval(soap_headers, (char*)trav->name, val); - } + UErrorCode status = U_ZERO_ERROR; + zstr u_name; + int u_name_len; + zend_string_to_unicode_ex(UG(utf8_conv), &u_name.u, &u_name_len, (char*)trav->name, strlen((char*)trav->name), &status); + add_u_assoc_zval_ex(soap_headers, IS_UNICODE, u_name, u_name_len+1, val); + efree(u_name.u); } trav = trav->next; } diff --git a/ext/soap/soap.c b/ext/soap/soap.c index b8dabe4a69..8f47ae1434 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -433,25 +433,9 @@ char* soap_unicode_to_string(UChar *ustr, int ustr_len TSRMLS_DC) void soap_decode_string(zval *ret, char* str TSRMLS_DC) { - if (UG(unicode)) { - /* TODO: unicode support */ - ZVAL_STRING(ret, str, 1); - zval_string_to_unicode_ex(ret, UG(utf8_conv) TSRMLS_CC); - } else if (SOAP_GLOBAL(encoding) != NULL) { - xmlBufferPtr in = xmlBufferCreateStatic(str, strlen(str)); - xmlBufferPtr out = xmlBufferCreate(); - int n = xmlCharEncOutFunc(SOAP_GLOBAL(encoding), out, in); - - if (n >= 0) { - ZVAL_STRING(ret, (char*)xmlBufferContent(out), 1); - } else { - ZVAL_STRING(ret, str, 1); - } - xmlBufferFree(out); - xmlBufferFree(in); - } else { - ZVAL_STRING(ret, str, 1); - } + /* TODO: unicode support */ + ZVAL_STRING(ret, str, 1); + zval_string_to_unicode_ex(ret, UG(utf8_conv) TSRMLS_CC); } char* soap_encode_string_ex(zend_uchar type, zstr data, int len TSRMLS_DC) @@ -1301,9 +1285,7 @@ PHP_METHOD(SoapFault, __toString) zval_ptr_dtor(&trace); RETVAL_STRINGL(str, len, 0); - if (UG(unicode)) { - zval_string_to_unicode(return_value TSRMLS_CC); - } + zval_string_to_unicode(return_value TSRMLS_CC); } /* }}} */ @@ -3085,18 +3067,15 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act INIT_ZVAL(param0); params[0] = ¶m0; ZVAL_STRINGL(params[0], buf, buf_size, 1); - if (UG(unicode)) { - zval_string_to_unicode_ex(params[0], UG(utf8_conv) TSRMLS_CC); - } + zval_string_to_unicode_ex(params[0], UG(utf8_conv) TSRMLS_CC); + INIT_ZVAL(param1); params[1] = ¶m1; if (location == NULL) { ZVAL_NULL(params[1]); } else { ZVAL_STRING(params[1], location, 1); - if (UG(unicode)) { - zval_string_to_unicode_ex(params[1], UG(utf8_conv) TSRMLS_CC); - } + zval_string_to_unicode_ex(params[1], UG(utf8_conv) TSRMLS_CC); } INIT_ZVAL(param2); params[2] = ¶m2; @@ -3104,9 +3083,7 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act ZVAL_NULL(params[2]); } else { ZVAL_STRING(params[2], action, 1); - if (UG(unicode)) { - zval_string_to_unicode_ex(params[2], UG(utf8_conv) TSRMLS_CC); - } + zval_string_to_unicode_ex(params[2], UG(utf8_conv) TSRMLS_CC); } INIT_ZVAL(param3); params[3] = ¶m3; @@ -3643,9 +3620,7 @@ PHP_METHOD(SoapClient, __doRequest) } else if (make_http_soap_request(this_ptr, buf.s, buf_size, location.s, action.s, version, &Z_STRVAL_P(return_value), &Z_STRLEN_P(return_value) TSRMLS_CC)) { return_value->type = IS_STRING; - if (UG(unicode)) { - zval_string_to_unicode_ex(return_value, UG(utf8_conv) TSRMLS_CC); - } + zval_string_to_unicode_ex(return_value, UG(utf8_conv) TSRMLS_CC); } if (buf_type == IS_UNICODE) { efree(buf.s); @@ -3779,9 +3754,7 @@ PHP_METHOD(SoapClient, __setLocation) } if (client->location) { RETVAL_STRING(client->location, 1); - if (UG(unicode)) { - zval_string_to_unicode_ex(return_value, UG(utf8_conv) TSRMLS_CC); - } + zval_string_to_unicode_ex(return_value, UG(utf8_conv) TSRMLS_CC); efree(client->location); client->location = NULL; } else { diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c index fbabaccd47..990bbbbff8 100755 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -257,7 +257,7 @@ int spl_autoload(const zstr class_name, const zstr lc_name, int class_name_len, } efree(class_file); - return zend_u_hash_exists(EG(class_table), ZEND_STR_TYPE, lc_name, class_name_len+1); + return zend_u_hash_exists(EG(class_table), IS_UNICODE, lc_name, class_name_len+1); } } efree(class_file); @@ -271,7 +271,6 @@ PHP_FUNCTION(spl_autoload) zstr class_name, lc_name; zstr file_exts = Z_UNIVAL(SPL_G(autoload_extensions)); int class_name_len, file_exts_len = Z_UNILEN(SPL_G(autoload_extensions)), found = 0; - int unicode = UG(unicode); zstr copy, pos1, pos2; zval **original_return_value = EG(return_value_ptr_ptr); zend_op **original_opline_ptr = EG(opline_ptr); @@ -281,18 +280,15 @@ PHP_FUNCTION(spl_autoload) RETURN_FALSE; } - copy = pos1 = ezstrndup(ZEND_STR_TYPE, file_exts, file_exts_len); - lc_name = zend_u_str_tolower_dup(ZEND_STR_TYPE, class_name, class_name_len); - while(pos1.v && (unicode ? *pos1.u : *pos1.s) && !EG(exception)) { + copy = pos1 = ezstrndup(IS_UNICODE, file_exts, file_exts_len); + lc_name = zend_u_str_tolower_dup(IS_UNICODE, class_name, class_name_len); + while(pos1.v && *pos1.u && !EG(exception)) { EG(return_value_ptr_ptr) = original_return_value; EG(opline_ptr) = original_opline_ptr; EG(active_op_array) = original_active_op_array; - if (unicode) { - pos2.u = u_strchr(pos1.u, ','); - if (pos2.u) *pos2.u = '\0'; - } else { - pos2.s = strchr(pos1.s, ','); - if (pos2.s) *pos2.s = '\0'; + pos2.u = u_strchr(pos1.u, ','); + if (pos2.u) { + *pos2.u = '\0'; } if (spl_autoload(class_name, lc_name, class_name_len, pos1 TSRMLS_CC)) { found = 1; @@ -300,10 +296,8 @@ PHP_FUNCTION(spl_autoload) } if (!pos2.v) { pos1.v = NULL; - } else if (unicode) { + } else { pos1.u = pos2.u + 1; - } else{ - pos1.s = pos2.s + 1; } } efree(lc_name.v); @@ -334,7 +328,7 @@ PHP_FUNCTION(spl_autoload_extensions) return; } zval_dtor(global); - ZVAL_ZSTRL(global, ZEND_STR_TYPE, file_exts, file_exts_len, 1); + ZVAL_ZSTRL(global, IS_UNICODE, file_exts, file_exts_len, 1); } RETURN_ZVAL(global, 1, 0); @@ -370,11 +364,11 @@ PHP_FUNCTION(spl_autoload_call) } MAKE_STD_ZVAL(zclass_name); - ZVAL_ZSTRL(zclass_name, ZEND_STR_TYPE, class_name, class_name_len, 1); + ZVAL_ZSTRL(zclass_name, IS_UNICODE, class_name, class_name_len, 1); if (SPL_G(autoload_functions)) { int l_autoload_running = SPL_G(autoload_running); SPL_G(autoload_running) = 1; - lc_name = zend_u_str_tolower_dup(ZEND_STR_TYPE, class_name, class_name_len); + lc_name = zend_u_str_tolower_dup(IS_UNICODE, class_name, class_name_len); zend_hash_internal_pointer_reset_ex(SPL_G(autoload_functions), &function_pos); while(zend_hash_has_more_elements_ex(SPL_G(autoload_functions), &function_pos) == SUCCESS) { func_name_type = zend_hash_get_current_key_ex(SPL_G(autoload_functions), &func_name, &func_name_len, &dummy, 0, &function_pos); @@ -384,7 +378,7 @@ PHP_FUNCTION(spl_autoload_call) if (retval) { zval_ptr_dtor(&retval); } - if (zend_u_hash_exists(EG(class_table), ZEND_STR_TYPE, lc_name, class_name_len+1)) { + if (zend_u_hash_exists(EG(class_table), IS_UNICODE, lc_name, class_name_len+1)) { break; } zend_hash_move_forward_ex(SPL_G(autoload_functions), &function_pos); diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index a3a3aa6384..5b364dbf10 100755 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -703,7 +703,7 @@ static HashTable* spl_array_get_debug_info(zval *obj, int *is_temp TSRMLS_DC) /* base = (Z_OBJ_HT_P(obj) == &spl_handler_ArrayIterator) ? spl_ce_ArrayIterator : spl_ce_ArrayObject; zname = spl_gen_private_prop_name(base, "storage", sizeof("storage")-1, &name_len TSRMLS_CC); - zend_u_symtable_update(rv, ZEND_STR_TYPE, zname, name_len+1, &storage, sizeof(zval *), NULL); + zend_u_symtable_update(rv, IS_UNICODE, zname, name_len+1, &storage, sizeof(zval *), NULL); efree(zname.v); return rv; @@ -778,10 +778,8 @@ static int spl_array_skip_protected(spl_array_object *intern, HashTable *aht TSR if (Z_TYPE_P(intern->array) == IS_OBJECT) { 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) && string_key.u[0]) || - (!UG(unicode) && string_key.s[0]))) { + if (zend_hash_get_current_key_ex(aht, &string_key, &string_length, &num_key, 0, &intern->pos) == HASH_KEY_IS_UNICODE) { + if (!string_length || string_key.u[0]) { return SUCCESS; } } else { diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index a3d84a0678..9784604451 100755 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -611,7 +611,7 @@ static HashTable* spl_filesystem_object_get_debug_info(zval *obj, int *is_temp T path = spl_filesystem_object_get_pathname(intern, &path_len, &path_type TSRMLS_CC); pnstr = spl_gen_private_prop_name(spl_ce_SplFileInfo, "pathName", sizeof("pathName")-1, &pnlen TSRMLS_CC); - add_u_assoc_zstrl_ex(&zrv, ZEND_STR_TYPE, pnstr, pnlen+1, path_type, path, path_len, 1); + add_u_assoc_zstrl_ex(&zrv, IS_UNICODE, pnstr, pnlen+1, path_type, path, path_len, 1); efree(pnstr.v); if (intern->file_name.v) { pnstr = spl_gen_private_prop_name(spl_ce_SplFileInfo, "fileName", sizeof("fileName")-1, &pnlen TSRMLS_CC); @@ -622,40 +622,40 @@ static HashTable* spl_filesystem_object_get_debug_info(zval *obj, int *is_temp T } else { path.s = intern->file_name.s + path_len + 1; } - add_u_assoc_zstrl_ex(&zrv, ZEND_STR_TYPE, pnstr, pnlen+1, intern->file_name_type, path, intern->file_name_len - (path_len + 1), 1); + add_u_assoc_zstrl_ex(&zrv, IS_UNICODE, pnstr, pnlen+1, intern->file_name_type, path, intern->file_name_len - (path_len + 1), 1); } else { - add_u_assoc_zstrl_ex(&zrv, ZEND_STR_TYPE, pnstr, pnlen+1, intern->file_name_type, intern->file_name, intern->file_name_len, 1); + add_u_assoc_zstrl_ex(&zrv, IS_UNICODE, pnstr, pnlen+1, intern->file_name_type, intern->file_name, intern->file_name_len, 1); } efree(pnstr.v); } if (intern->type == SPL_FS_DIR) { pnstr = spl_gen_private_prop_name(spl_ce_DirectoryIterator, "glob", sizeof("glob")-1, &pnlen TSRMLS_CC); if (php_stream_is(intern->u.dir.dirp ,&php_glob_stream_ops)) { - add_u_assoc_zstrl_ex(&zrv, ZEND_STR_TYPE, pnstr, pnlen+1, intern->_path_type, intern->_path, intern->_path_len, 1); + add_u_assoc_zstrl_ex(&zrv, IS_UNICODE, pnstr, pnlen+1, intern->_path_type, intern->_path, intern->_path_len, 1); } else { - add_u_assoc_bool_ex(&zrv, ZEND_STR_TYPE, pnstr, pnlen+1, 0); + add_u_assoc_bool_ex(&zrv, IS_UNICODE, pnstr, pnlen+1, 0); } efree(pnstr.v); pnstr = spl_gen_private_prop_name(spl_ce_RecursiveDirectoryIterator, "subPathName", sizeof("subPathName")-1, &pnlen TSRMLS_CC); if (intern->u.dir.sub_path.v) { - add_u_assoc_zstrl_ex(&zrv, ZEND_STR_TYPE, pnstr, pnlen+1, intern->u.dir.sub_path_type, intern->u.dir.sub_path, intern->u.dir.sub_path_len, 1); + add_u_assoc_zstrl_ex(&zrv, IS_UNICODE, pnstr, pnlen+1, intern->u.dir.sub_path_type, intern->u.dir.sub_path, intern->u.dir.sub_path_len, 1); } else { - add_u_assoc_zstrl_ex(&zrv, ZEND_STR_TYPE, pnstr, pnlen+1, ZEND_STR_TYPE, EMPTY_ZSTR, 0, 1); + add_u_assoc_zstrl_ex(&zrv, IS_UNICODE, pnstr, pnlen+1, IS_UNICODE, EMPTY_ZSTR, 0, 1); } efree(pnstr.v); } if (intern->type == SPL_FS_FILE) { pnstr = spl_gen_private_prop_name(spl_ce_SplFileObject, "openMode", sizeof("openMode")-1, &pnlen TSRMLS_CC); - add_u_assoc_stringl_ex(&zrv, ZEND_STR_TYPE, pnstr, pnlen+1, intern->u.file.open_mode, intern->u.file.open_mode_len, 1); + add_u_assoc_stringl_ex(&zrv, IS_UNICODE, pnstr, pnlen+1, intern->u.file.open_mode, intern->u.file.open_mode_len, 1); efree(pnstr.v); stmp[1] = '\0'; stmp[0] = intern->u.file.delimiter; pnstr = spl_gen_private_prop_name(spl_ce_SplFileObject, "delimiter", sizeof("delimiter")-1, &pnlen TSRMLS_CC); - add_u_assoc_stringl_ex(&zrv, ZEND_STR_TYPE, pnstr, pnlen+1, stmp, 1, 1); + add_u_assoc_stringl_ex(&zrv, IS_UNICODE, pnstr, pnlen+1, stmp, 1, 1); efree(pnstr.v); stmp[0] = intern->u.file.enclosure; pnstr = spl_gen_private_prop_name(spl_ce_SplFileObject, "enclosure", sizeof("enclosure")-1, &pnlen TSRMLS_CC); - add_u_assoc_stringl_ex(&zrv, ZEND_STR_TYPE, pnstr, pnlen+1, stmp, 1, 1); + add_u_assoc_stringl_ex(&zrv, IS_UNICODE, pnstr, pnlen+1, stmp, 1, 1); efree(pnstr.v); } @@ -1156,12 +1156,8 @@ SPL_METHOD(SplFileInfo, getLinkTarget) /* Append NULL to the end of the string */ buff[ret] = '\0'; - if (UG(unicode)) { - if (SUCCESS == php_stream_path_decode(NULL, &target, &target_len, buff, ret, REPORT_ERRORS, FG(default_context))) { - RETVAL_UNICODEL(target, target_len, 0); - } else { - RETVAL_STRING(buff, 1); - } + if (SUCCESS == php_stream_path_decode(NULL, &target, &target_len, buff, ret, REPORT_ERRORS, FG(default_context))) { + RETVAL_UNICODEL(target, target_len, 0); } else { RETVAL_STRING(buff, 1); } @@ -1205,12 +1201,8 @@ SPL_METHOD(SplFileInfo, getRealPath) RETVAL_FALSE; } else #endif - if (UG(unicode)) { - if (php_stream_path_decode(NULL, &path, &path_len, buff, strlen(buff), REPORT_ERRORS, FG(default_context)) == SUCCESS) { - RETVAL_UNICODEL(path, path_len, 0); - } else { - RETVAL_STRING(buff, 1); - } + if (php_stream_path_decode(NULL, &path, &path_len, buff, strlen(buff), REPORT_ERRORS, FG(default_context)) == SUCCESS) { + RETVAL_UNICODEL(path, path_len, 0); } else { RETVAL_STRING(buff, 1); } @@ -1740,7 +1732,7 @@ static int spl_filesystem_object_cast(zval *readobj, zval *writeobj, int type, v zval_unicode_to_string_ex(writeobj, ZEND_U_CONVERTER(((UConverter *)extra)) TSRMLS_CC); return SUCCESS; } - if (type == IS_UNICODE && UG(unicode)) { + if (type == IS_UNICODE) { ZVAL_ASCII_STRINGL(writeobj, intern->file_name.s, intern->file_name_len, 1); return SUCCESS; } @@ -1750,7 +1742,7 @@ static int spl_filesystem_object_cast(zval *readobj, zval *writeobj, int type, v ZVAL_STRING(writeobj, intern->u.dir.entry.d_name, 1); return SUCCESS; } - if (type == IS_UNICODE && UG(unicode)) { + if (type == IS_UNICODE) { ZVAL_ASCII_STRING(writeobj, intern->u.dir.entry.d_name, 1); return SUCCESS; } diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c index f55e221262..dde49a8755 100644 --- a/ext/spl/spl_dllist.c +++ b/ext/spl/spl_dllist.c @@ -513,7 +513,7 @@ static HashTable* spl_dllist_object_get_debug_info(zval *obj, int *is_temp TSRML zend_hash_copy(rv, intern->std.properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); pnstr = spl_gen_private_prop_name(spl_ce_SplDoublyLinkedList, "flags", sizeof("flags")-1, &pnlen TSRMLS_CC); - add_u_assoc_long_ex(&zrv, ZEND_STR_TYPE, pnstr, pnlen+1, intern->flags); + add_u_assoc_long_ex(&zrv, IS_UNICODE, pnstr, pnlen+1, intern->flags); efree(pnstr.v); ALLOC_INIT_ZVAL(dllist_array); @@ -530,7 +530,7 @@ static HashTable* spl_dllist_object_get_debug_info(zval *obj, int *is_temp TSRML } pnstr = spl_gen_private_prop_name(spl_ce_SplDoublyLinkedList, "dllist", sizeof("dllist")-1, &pnlen TSRMLS_CC); - add_u_assoc_zval_ex(&zrv, ZEND_STR_TYPE, pnstr, pnlen+1, dllist_array); + add_u_assoc_zval_ex(&zrv, IS_UNICODE, pnstr, pnlen+1, dllist_array); efree(pnstr.v); return rv; diff --git a/ext/spl/spl_engine.h b/ext/spl/spl_engine.h index 0c8eab3721..14db37a54f 100755 --- a/ext/spl/spl_engine.h +++ b/ext/spl/spl_engine.h @@ -35,7 +35,7 @@ static inline int spl_instantiate_arg_ex1(zend_class_entry *pce, zval **retval, { spl_instantiate(pce, retval, alloc TSRMLS_CC); - zend_u_call_method(retval, pce, &pce->constructor, ZEND_STR_TYPE, pce->constructor->common.function_name, USTR_LEN(pce->constructor->common.function_name), NULL, 1, arg1, NULL TSRMLS_CC); + zend_u_call_method(retval, pce, &pce->constructor, IS_UNICODE, pce->constructor->common.function_name, USTR_LEN(pce->constructor->common.function_name), NULL, 1, arg1, NULL TSRMLS_CC); return 0; } /* }}} */ @@ -45,7 +45,7 @@ static inline int spl_instantiate_arg_ex2(zend_class_entry *pce, zval **retval, { spl_instantiate(pce, retval, alloc TSRMLS_CC); - zend_u_call_method(retval, pce, &pce->constructor, ZEND_STR_TYPE, pce->constructor->common.function_name, USTR_LEN(pce->constructor->common.function_name), NULL, 2, arg1, arg2 TSRMLS_CC); + zend_u_call_method(retval, pce, &pce->constructor, IS_UNICODE, pce->constructor->common.function_name, USTR_LEN(pce->constructor->common.function_name), NULL, 2, arg1, arg2 TSRMLS_CC); return 0; } /* }}} */ diff --git a/ext/spl/spl_functions.c b/ext/spl/spl_functions.c index c09fb8ae0a..c5d2bc2a1d 100755 --- a/ext/spl/spl_functions.c +++ b/ext/spl/spl_functions.c @@ -82,12 +82,11 @@ void spl_add_class_name(zval *list, zend_class_entry * pce, int allow, int ce_fl if (!allow || (allow > 0 && pce->ce_flags & ce_flags) || (allow < 0 && !(pce->ce_flags & ce_flags))) { size_t len = pce->name_length; zval *tmp; - zend_uchar ztype = UG(unicode)?IS_UNICODE:IS_STRING; - if (zend_u_hash_find(Z_ARRVAL_P(list), ztype, pce->name, len+1, (void*)&tmp) == FAILURE) { + if (zend_u_hash_find(Z_ARRVAL_P(list), IS_UNICODE, pce->name, len+1, (void*)&tmp) == FAILURE) { MAKE_STD_ZVAL(tmp); ZVAL_TEXTL(tmp, pce->name, pce->name_length, 1); - zend_u_hash_add(Z_ARRVAL_P(list), ztype, pce->name, len+1, &tmp, sizeof(zval *), NULL); + zend_u_hash_add(Z_ARRVAL_P(list), IS_UNICODE, pce->name, len+1, &tmp, sizeof(zval *), NULL); } } } @@ -127,13 +126,9 @@ zstr spl_gen_private_prop_name(zend_class_entry *ce, char *prop_name, int prop_l zstr rv; zstr zprop; - if (UG(unicode)) { - zprop.u = zend_ascii_to_unicode(prop_name, prop_len + 1 ZEND_FILE_LINE_CC); - zend_u_mangle_property_name(&rv, name_len, IS_UNICODE, ce->name, ce->name_length, zprop, prop_len, 0); - efree(zprop.v); - } else { - zend_mangle_property_name(&rv.s, name_len, ce->name.s, ce->name_length, prop_name, prop_len, 0); - } + zprop.u = zend_ascii_to_unicode(prop_name, prop_len + 1 ZEND_FILE_LINE_CC); + zend_u_mangle_property_name(&rv, name_len, IS_UNICODE, ce->name, ce->name_length, zprop, prop_len, 0); + efree(zprop.v); return rv; } /* }}} */ diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c index c982dc8512..7903b905d9 100644 --- a/ext/spl/spl_heap.c +++ b/ext/spl/spl_heap.c @@ -531,11 +531,11 @@ static HashTable* spl_heap_object_get_debug_info_helper(zend_class_entry *ce, zv zend_hash_copy(rv, intern->std.properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); pnstr = spl_gen_private_prop_name(ce, "flags", sizeof("flags")-1, &pnlen TSRMLS_CC); - add_u_assoc_long_ex(&zrv, ZEND_STR_TYPE, pnstr, pnlen+1, intern->flags); + add_u_assoc_long_ex(&zrv, IS_UNICODE, pnstr, pnlen+1, intern->flags); efree(pnstr.v); pnstr = spl_gen_private_prop_name(ce, "isCorrupted", sizeof("isCorrupted")-1, &pnlen TSRMLS_CC); - add_u_assoc_bool_ex(&zrv, ZEND_STR_TYPE, pnstr, pnlen+1, intern->heap->flags&SPL_HEAP_CORRUPTED); + add_u_assoc_bool_ex(&zrv, IS_UNICODE, pnstr, pnlen+1, intern->heap->flags&SPL_HEAP_CORRUPTED); efree(pnstr.v); ALLOC_INIT_ZVAL(heap_array); @@ -547,7 +547,7 @@ static HashTable* spl_heap_object_get_debug_info_helper(zend_class_entry *ce, zv } pnstr = spl_gen_private_prop_name(ce, "heap", sizeof("heap")-1, &pnlen TSRMLS_CC); - add_u_assoc_zval_ex(&zrv, ZEND_STR_TYPE, pnstr, pnlen+1, heap_array); + add_u_assoc_zval_ex(&zrv, IS_UNICODE, pnstr, pnlen+1, heap_array); efree(pnstr.v); return rv; diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index c997273940..de1d1d30d7 100755 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -766,7 +766,7 @@ static union _zend_function *spl_recursive_it_get_method(zval **object_ptr, zstr function_handler = std_object_handlers.get_method(object_ptr, method, method_len TSRMLS_CC); if (!function_handler) { - 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 (zend_u_hash_find(&Z_OBJCE_P(zobj)->function_table, IS_UNICODE, 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); @@ -935,7 +935,7 @@ static void spl_recursive_tree_iterator_get_entry(spl_recursive_it_object * obje zval_dtor(return_value); ZVAL_STRINGL(return_value, "Array", sizeof("Array")-1, 1); } else if (Z_TYPE_PP(data) != IS_UNICODE && Z_TYPE_PP(data) != IS_STRING) { - convert_to_text(return_value); + convert_to_unicode(return_value); } zend_restore_error_handling(&error_handling TSRMLS_CC); } @@ -982,9 +982,8 @@ SPL_METHOD(RecursiveTreeIterator, setPrefixPart) SPL_METHOD(RecursiveTreeIterator, getPrefix) { spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); - zend_uchar return_type = (UG(unicode) ? IS_UNICODE : IS_STRING); - spl_recursive_tree_iterator_get_prefix(object, return_value, return_type TSRMLS_CC); + spl_recursive_tree_iterator_get_prefix(object, return_value, IS_UNICODE TSRMLS_CC); } /* }}} */ /* {{{ proto string RecursiveTreeIterator::getEntry() U @@ -1001,9 +1000,8 @@ SPL_METHOD(RecursiveTreeIterator, getEntry) SPL_METHOD(RecursiveTreeIterator, getPostfix) { spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); - zend_uchar return_type = (UG(unicode) ? IS_UNICODE : IS_STRING); - spl_recursive_tree_iterator_get_postfix(object, return_value, return_type TSRMLS_CC); + spl_recursive_tree_iterator_get_postfix(object, return_value, IS_UNICODE TSRMLS_CC); } /* }}} */ /* {{{ proto mixed RecursiveTreeIterator::current() U @@ -1105,7 +1103,7 @@ SPL_METHOD(RecursiveTreeIterator, key) } if (Z_TYPE(key) != IS_UNICODE && Z_TYPE(key) != IS_STRING) { - convert_to_text(&key); + convert_to_unicode(&key); } return_type = Z_TYPE(key); @@ -1208,7 +1206,7 @@ static union _zend_function *spl_dual_it_get_method(zval **object_ptr, zstr meth function_handler = std_object_handlers.get_method(object_ptr, method, method_len TSRMLS_CC); if (!function_handler) { - 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 (zend_u_hash_find(&intern->inner.ce->function_table, IS_UNICODE, 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); @@ -1413,7 +1411,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z } intern->u.regex.mode = mode; intern->u.regex.regex = estrndup(regex, regex_len); - intern->u.regex.pce = pcre_get_compiled_regex_cache(ZEND_STR_TYPE, regex, regex_len TSRMLS_CC); + intern->u.regex.pce = pcre_get_compiled_regex_cache(IS_UNICODE, regex, regex_len TSRMLS_CC); if (intern->u.regex.pce == NULL) { /* pcre_get_compiled_regex_cache has already sent error */ zend_restore_error_handling(&error_handling TSRMLS_CC); @@ -1814,7 +1812,7 @@ SPL_METHOD(RegexIterator, accept) } zval_ptr_dtor(&intern->current.data); ALLOC_INIT_ZVAL(intern->current.data); - php_pcre_match_impl(intern->u.regex.pce, ZEND_STR_TYPE, subject, subject_len, &zcount, + php_pcre_match_impl(intern->u.regex.pce, IS_UNICODE, subject, subject_len, &zcount, intern->current.data, intern->u.regex.mode == REGIT_MODE_ALL_MATCHES, intern->u.regex.use_flags, intern->u.regex.preg_flags, 0 TSRMLS_CC); count = zend_hash_num_elements(Z_ARRVAL_P(intern->current.data)); RETVAL_BOOL(count > 0); @@ -1827,14 +1825,14 @@ SPL_METHOD(RegexIterator, accept) } zval_ptr_dtor(&intern->current.data); ALLOC_INIT_ZVAL(intern->current.data); - php_pcre_split_impl(intern->u.regex.pce, ZEND_STR_TYPE, subject, subject_len, intern->current.data, -1, intern->u.regex.preg_flags TSRMLS_CC); + php_pcre_split_impl(intern->u.regex.pce, IS_UNICODE, subject, subject_len, intern->current.data, -1, intern->u.regex.preg_flags TSRMLS_CC); count = zend_hash_num_elements(Z_ARRVAL_P(intern->current.data)); RETVAL_BOOL(count > 1); break; case REGIT_MODE_REPLACE: replacement = zend_read_property(intern->std.ce, getThis(), "replacement", sizeof("replacement")-1, 1 TSRMLS_CC); - result = php_pcre_replace_impl(intern->u.regex.pce, ZEND_STR_TYPE, subject, subject_len, replacement, 0, &result_len, 0, NULL TSRMLS_CC); + result = php_pcre_replace_impl(intern->u.regex.pce, IS_UNICODE, subject, subject_len, replacement, 0, &result_len, 0, NULL TSRMLS_CC); if (intern->u.regex.flags & REGIT_USE_KEY) { if (intern->current.key_type != HASH_KEY_IS_LONG) { @@ -2345,11 +2343,7 @@ static inline void spl_caching_it_next(spl_dual_it_object *intern TSRMLS_DC) } else { *intern->u.caching.zstr = *intern->current.data; } - if (UG(unicode)) { - zend_make_unicode_zval(intern->u.caching.zstr, &expr_copy, &use_copy); - } else { - zend_make_string_zval(intern->u.caching.zstr, &expr_copy, &use_copy); - } + zend_make_unicode_zval(intern->u.caching.zstr, &expr_copy, &use_copy); if (use_copy) { *intern->u.caching.zstr = expr_copy; INIT_PZVAL(intern->u.caching.zstr); @@ -2443,13 +2437,13 @@ SPL_METHOD(CachingIterator, __toString) RETURN_UNICODEL(intern->current.str_key.u, intern->current.str_key_len-1, 1); } else { RETVAL_LONG(intern->current.int_key); - convert_to_text(return_value); + convert_to_unicode(return_value); return; } } else if (intern->u.caching.flags & CIT_TOSTRING_USE_CURRENT) { *return_value = *intern->current.data; zval_copy_ctor(return_value); - convert_to_text(return_value); + convert_to_unicode(return_value); INIT_PZVAL(return_value); return; } diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c index 4b478429d1..0e8f1e4106 100755 --- a/ext/spl/spl_observer.c +++ b/ext/spl/spl_observer.c @@ -268,7 +268,7 @@ static HashTable* spl_object_storage_debug_info(zval *obj, int *is_temp TSRMLS_D } zname = spl_gen_private_prop_name(spl_ce_SplObjectStorage, "storage", sizeof("storage")-1, &name_len TSRMLS_CC); - zend_u_symtable_update(rv, ZEND_STR_TYPE, zname, name_len+1, &storage, sizeof(zval *), NULL); + zend_u_symtable_update(rv, IS_UNICODE, zname, name_len+1, &storage, sizeof(zval *), NULL); efree(zname.v); return rv; diff --git a/ext/sqlite/sqlite.c b/ext/sqlite/sqlite.c index 13c3f14383..d6e343673d 100644 --- a/ext/sqlite/sqlite.c +++ b/ext/sqlite/sqlite.c @@ -2185,8 +2185,7 @@ PHP_FUNCTION(sqlite_fetch_column_types) } if (result_type == PHPSQLITE_ASSOC) { - if (UG(unicode) && - SUCCESS == zend_string_to_unicode(SQLITE2_CONV, &(colname.u), &colname_len, (char*)colnames[i], strlen((char*)colnames[i]) TSRMLS_CC)) { + if (SUCCESS == zend_string_to_unicode(SQLITE2_CONV, &(colname.u), &colname_len, (char*)colnames[i], strlen((char*)colnames[i]) TSRMLS_CC)) { colname_type = IS_UNICODE; if (SQLITE_G(assoc_case) == 1) { UChar *tmp; @@ -2397,8 +2396,7 @@ static void php_sqlite_fetch_array(struct php_sqlite_result *res, int mode, zend Z_ADDREF_P(decoded); - if (UG(unicode) && - SUCCESS == zend_string_to_unicode(SQLITE2_CONV, &colname, &colname_len, (char*)colnames[j], strlen((char*)colnames[j]) TSRMLS_CC)) { + if (SUCCESS == zend_string_to_unicode(SQLITE2_CONV, &colname, &colname_len, (char*)colnames[j], strlen((char*)colnames[j]) TSRMLS_CC)) { add_u_assoc_zval_ex(return_value, IS_UNICODE, ZSTR(colname), colname_len + 1, decoded); efree(colname); } else { diff --git a/ext/standard/array.c b/ext/standard/array.c index 3c1ddfbd66..a06e41a045 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -1262,69 +1262,36 @@ PHPAPI int php_prefix_varname(zval *result, zval *prefix, zstr var_name, int var { Z_UNILEN_P(result) = Z_UNILEN_P(prefix) + (add_underscore ? 1 : 0) + var_name_len; - if (UG(unicode)) { - Z_TYPE_P(result) = IS_UNICODE; - Z_USTRVAL_P(result) = eumalloc(Z_USTRLEN_P(result) + 1); - u_memcpy(Z_USTRVAL_P(result), Z_USTRVAL_P(prefix), Z_USTRLEN_P(prefix)); + Z_TYPE_P(result) = IS_UNICODE; + Z_USTRVAL_P(result) = eumalloc(Z_USTRLEN_P(result) + 1); + u_memcpy(Z_USTRVAL_P(result), Z_USTRVAL_P(prefix), Z_USTRLEN_P(prefix)); - if (add_underscore) { - Z_USTRVAL_P(result)[Z_USTRLEN_P(prefix)] = (UChar) 0x5f /*'_'*/; - } + if (add_underscore) { + Z_USTRVAL_P(result)[Z_USTRLEN_P(prefix)] = (UChar) 0x5f /*'_'*/; + } - if (var_name_type == IS_UNICODE) { - u_memcpy(Z_USTRVAL_P(result)+Z_USTRLEN_P(prefix) + (add_underscore ? 1 : 0), var_name.u, var_name_len + 1); - } else { - UChar *buf; - int buf_len; - UErrorCode status = U_ZERO_ERROR; - - zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), - &buf, &buf_len, var_name.s, var_name_len, &status); - if (U_FAILURE(status)) { - zval_dtor(result); - ZVAL_NULL(result); - php_error_docref(NULL TSRMLS_CC, E_WARNING, "could not convert variable name to Unicode string"); - return FAILURE; - } - if (buf_len > var_name_len) { - Z_USTRLEN_P(result) = Z_USTRLEN_P(prefix) + (add_underscore ? 1 : 0) + buf_len; - Z_USTRVAL_P(result) = eurealloc(Z_USTRVAL_P(result), Z_USTRLEN_P(result) + 1); - } - u_memcpy(Z_USTRVAL_P(result)+Z_USTRLEN_P(prefix) + (add_underscore ? 1 : 0), buf, buf_len + 1); - efree(buf); - } + if (var_name_type == IS_UNICODE) { + u_memcpy(Z_USTRVAL_P(result)+Z_USTRLEN_P(prefix) + (add_underscore ? 1 : 0), var_name.u, var_name_len + 1); } else { - Z_TYPE_P(result) = IS_STRING; - Z_STRVAL_P(result) = emalloc(Z_STRLEN_P(result) + 1); - memcpy(Z_STRVAL_P(result), Z_STRVAL_P(prefix), Z_STRLEN_P(prefix)); + UChar *buf; + int buf_len; + UErrorCode status = U_ZERO_ERROR; - if (add_underscore) { - Z_STRVAL_P(result)[Z_STRLEN_P(prefix)] = '_'; + zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), + &buf, &buf_len, var_name.s, var_name_len, &status); + if (U_FAILURE(status)) { + zval_dtor(result); + ZVAL_NULL(result); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "could not convert variable name to Unicode string"); + return FAILURE; } - - if (var_name_type == IS_STRING) { - memcpy(Z_STRVAL_P(result) + Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0), var_name.s, var_name_len + 1); - } else { - char *buf; - int buf_len; - UErrorCode status = U_ZERO_ERROR; - - zend_unicode_to_string_ex(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &buf, &buf_len, var_name.u, var_name_len, &status); - if (U_FAILURE(status)) { - zval_dtor(result); - ZVAL_NULL(result); - php_error_docref(NULL TSRMLS_CC, E_WARNING, "could not convert variable name to string"); - return FAILURE; - } - if (buf_len > var_name_len) { - Z_STRLEN_P(result) = Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0) + buf_len; - Z_STRVAL_P(result) = erealloc(Z_STRVAL_P(result), Z_STRLEN_P(result) + 1); - } - memcpy(Z_STRVAL_P(result) + Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0), buf, buf_len + 1); - efree(buf); + if (buf_len > var_name_len) { + Z_USTRLEN_P(result) = Z_USTRLEN_P(prefix) + (add_underscore ? 1 : 0) + buf_len; + Z_USTRVAL_P(result) = eurealloc(Z_USTRVAL_P(result), Z_USTRLEN_P(result) + 1); } + u_memcpy(Z_USTRVAL_P(result)+Z_USTRLEN_P(prefix) + (add_underscore ? 1 : 0), buf, buf_len + 1); + efree(buf); } - return SUCCESS; } /* }}} */ @@ -1361,7 +1328,7 @@ PHP_FUNCTION(extract) } if (prefix) { - convert_to_text(prefix); + convert_to_unicode(prefix); if (Z_UNILEN_P(prefix) && !php_valid_var_name(Z_UNIVAL_P(prefix), Z_UNILEN_P(prefix), Z_TYPE_P(prefix))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "prefix is not a valid identifier"); return; @@ -1402,7 +1369,7 @@ PHP_FUNCTION(extract) zval num; ZVAL_LONG(&num, num_key); - convert_to_text(&num); + convert_to_unicode(&num); php_prefix_varname(&final_name, prefix, Z_UNIVAL(num), Z_UNILEN(num), Z_TYPE(num), 1 TSRMLS_CC); zval_dtor(&num); } else { @@ -1458,10 +1425,8 @@ PHP_FUNCTION(extract) break; } - if (UG(unicode) && Z_TYPE(final_name) == IS_STRING) { + if (Z_TYPE(final_name) == IS_STRING) { convert_to_unicode(&final_name); - } else if (!UG(unicode) && Z_TYPE(final_name) == IS_UNICODE) { - convert_to_string(&final_name); } if (Z_TYPE(final_name) != IS_NULL && php_valid_var_name(Z_UNIVAL(final_name), Z_UNILEN(final_name), Z_TYPE(final_name))) { @@ -1646,7 +1611,7 @@ PHP_FUNCTION(array_fill_keys) if (Z_TYPE_PP(entry) != IS_STRING && Z_TYPE_PP(entry) != IS_UNICODE) { key = **entry; zval_copy_ctor(&key); - convert_to_text(&key); + convert_to_unicode(&key); key_ptr = &key; } @@ -4552,7 +4517,7 @@ PHP_FUNCTION(array_key_exists) } RETURN_FALSE; case IS_NULL: - if (zend_u_hash_exists(array, (UG(unicode) ? IS_UNICODE : IS_STRING), EMPTY_ZSTR, 1)) { + if (zend_u_hash_exists(array, IS_UNICODE, EMPTY_ZSTR, 1)) { RETURN_TRUE; } RETURN_FALSE; @@ -4687,7 +4652,7 @@ PHP_FUNCTION(array_combine) if (Z_TYPE_PP(entry_keys) != IS_STRING && Z_TYPE_PP(entry_keys) != IS_UNICODE) { key = **entry_keys; zval_copy_ctor(&key); - convert_to_text(&key); + convert_to_unicode(&key); key_ptr = &key; } diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 57a6c41334..0f47a2bbb6 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -4768,7 +4768,7 @@ PHP_FUNCTION(call_user_method) RETURN_FALSE; } - convert_to_text(callback); + convert_to_unicode(callback); if (call_user_function_ex(EG(function_table), &object, callback, &retval_ptr, n_params, params, 0, NULL TSRMLS_CC) == SUCCESS) { if (retval_ptr) { @@ -4802,7 +4802,7 @@ PHP_FUNCTION(call_user_method_array) RETURN_FALSE; } - convert_to_text(callback); + convert_to_unicode(callback); params_ar = HASH_OF(params); num_elems = zend_hash_num_elements(params_ar); @@ -5214,7 +5214,7 @@ PHP_FUNCTION(highlight_string) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|b", &expr, &i) == FAILURE) { RETURN_FALSE; } - convert_to_text_ex(expr); + convert_to_unicode_ex(expr); if (i) { php_output_start_default(TSRMLS_C); @@ -5481,7 +5481,7 @@ PHP_FUNCTION(set_include_path) new_value.s = temp; new_value_len = temp_len; free_new_value = 1; - } else if (UG(unicode)) { + } else { UErrorCode status = U_ZERO_ERROR; if (ucnv_getType(ZEND_U_CONVERTER(UG(filesystem_encoding_conv))) != UCNV_UTF8) { @@ -5721,7 +5721,7 @@ PHP_FUNCTION(register_tick_function) } if (Z_TYPE_P(tick_fe.arguments[0]) != IS_ARRAY && Z_TYPE_P(tick_fe.arguments[0]) != IS_OBJECT) { - convert_to_text_ex(&tick_fe.arguments[0]); + convert_to_unicode_ex(&tick_fe.arguments[0]); } if (!BG(user_tick_functions)) { @@ -5758,7 +5758,7 @@ PHP_FUNCTION(unregister_tick_function) } if (Z_TYPE_P(function) != IS_ARRAY) { - convert_to_text(function); + convert_to_unicode(function); } tick_fe.arguments = (zval **) emalloc(sizeof(zval *)); @@ -5889,11 +5889,10 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int cal zval_copy_ctor(&name); INIT_PZVAL(&name); - if (UG(unicode)) { - convert_to_unicode_with_converter(element, UG(utf8_conv)); - convert_to_unicode_with_converter(&name, UG(utf8_conv)); - } - zend_u_symtable_update(Z_ARRVAL_P(arr), ZEND_STR_TYPE, Z_UNIVAL(name), Z_UNILEN(name) + 1, &element, sizeof(zval *), NULL); + convert_to_unicode_with_converter(element, UG(utf8_conv)); + convert_to_unicode_with_converter(&name, UG(utf8_conv)); + + zend_u_symtable_update(Z_ARRVAL_P(arr), IS_UNICODE, Z_UNIVAL(name), Z_UNILEN(name) + 1, &element, sizeof(zval *), NULL); zval_dtor(&name); break; @@ -5921,28 +5920,21 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int cal zstr key; int key_len; - if (UG(unicode)) { - if (zend_string_to_unicode(UG(utf8_conv), &key.u, &key_len, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) TSRMLS_CC) == FAILURE) { - return; - } - } else { - key.s = Z_STRVAL_P(arg1); - key_len = Z_STRLEN_P(arg1); + if (zend_string_to_unicode(UG(utf8_conv), &key.u, &key_len, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) TSRMLS_CC) == FAILURE) { + return; } - if (zend_u_hash_find(Z_ARRVAL_P(arr), ZEND_STR_TYPE, key, key_len+1, (void **) &find_hash) == FAILURE) { + if (zend_u_hash_find(Z_ARRVAL_P(arr), IS_UNICODE, key, key_len+1, (void **) &find_hash) == FAILURE) { ALLOC_ZVAL(hash); INIT_PZVAL(hash); array_init(hash); - zend_u_hash_update(Z_ARRVAL_P(arr), ZEND_STR_TYPE, key, key_len+1, &hash, sizeof(zval *), NULL); + zend_u_hash_update(Z_ARRVAL_P(arr), IS_UNICODE, key, key_len+1, &hash, sizeof(zval *), NULL); } else { hash = *find_hash; } - if (UG(unicode)) { - efree(key.u); - } + efree(key.u); } if (Z_TYPE_P(hash) != IS_ARRAY) { @@ -5956,9 +5948,7 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int cal zval_copy_ctor(element); INIT_PZVAL(element); - if (UG(unicode)) { - convert_to_unicode_with_converter(element, UG(utf8_conv)); - } + convert_to_unicode_with_converter(element, UG(utf8_conv)); if (arg3 && Z_STRLEN_P(arg3) > 0) { add_assoc_zval_ex(hash, Z_STRVAL_P(arg3), Z_STRLEN_P(arg3) + 1, element); @@ -5987,10 +5977,9 @@ static void php_ini_parser_cb_with_sections(zval *arg1, zval *arg2, zval *arg3, zval_copy_ctor(&name); INIT_PZVAL(&name); - if (UG(unicode)) { - convert_to_unicode_with_converter(&name, UG(utf8_conv)); - } - zend_u_symtable_update(Z_ARRVAL_P(arr), ZEND_STR_TYPE, Z_UNIVAL(name), Z_UNILEN(name) + 1, &BG(active_ini_file_section), sizeof(zval *), NULL); + convert_to_unicode_with_converter(&name, UG(utf8_conv)); + + zend_u_symtable_update(Z_ARRVAL_P(arr), IS_UNICODE, Z_UNIVAL(name), Z_UNILEN(name) + 1, &BG(active_ini_file_section), sizeof(zval *), NULL); zval_dtor(&name); } else if (arg2) { zval *active_arr; @@ -6123,7 +6112,7 @@ static int copy_request_variable(void *pDest TSRMLS_DC, int num_args, va_list ar } else { zval num; ZVAL_LONG(&num, hash_key->h); - convert_to_text(&num); + convert_to_unicode(&num); php_prefix_varname(&new_key, prefix, Z_UNIVAL(num), Z_UNILEN(num), Z_TYPE(num), 0 TSRMLS_CC); zval_dtor(&num); } @@ -6155,7 +6144,7 @@ PHP_FUNCTION(import_request_variables) } if (ZEND_NUM_ARGS() > 1) { - convert_to_text(prefix); + convert_to_unicode(prefix); if (Z_UNILEN_P(prefix) == 0) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "No prefix specified - possible security hazard"); diff --git a/ext/standard/dir.c b/ext/standard/dir.c index f32f2cd3bb..c858fec82c 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -521,6 +521,9 @@ no_results: array_init(return_value); for (n = 0; n < globbuf.gl_pathc; n++) { + UChar *path; + int path_len; + if (PG(open_basedir) && *PG(open_basedir)) { if (php_check_open_basedir_ex(globbuf.gl_pathv[n], 0 TSRMLS_CC)) { basedir_limit = 1; @@ -546,18 +549,12 @@ no_results: continue; } } - if (UG(unicode)) { - UChar *path; - int path_len; - - if (SUCCESS == php_stream_path_decode(&php_plain_files_wrapper, &path, &path_len, globbuf.gl_pathv[n]+cwd_skip, - strlen(globbuf.gl_pathv[n]+cwd_skip), REPORT_ERRORS, FG(default_context))) { - add_next_index_unicodel(return_value, path, path_len, 0); - } else { - /* Fallback on string version, path_decode will emit warning */ - add_next_index_string(return_value, globbuf.gl_pathv[n]+cwd_skip, 1); - } + + if (SUCCESS == php_stream_path_decode(&php_plain_files_wrapper, &path, &path_len, globbuf.gl_pathv[n]+cwd_skip, + strlen(globbuf.gl_pathv[n]+cwd_skip), REPORT_ERRORS, FG(default_context))) { + add_next_index_unicodel(return_value, path, path_len, 0); } else { + /* Fallback on string version, path_decode will emit warning */ add_next_index_string(return_value, globbuf.gl_pathv[n]+cwd_skip, 1); } } @@ -607,18 +604,14 @@ PHP_FUNCTION(scandir) array_init(return_value); for (i = 0; i < n; i++) { - if (UG(unicode)) { - UChar *path; - int path_len; - - if (SUCCESS == php_stream_path_decode(NULL, &path, &path_len, namelist[i], strlen(namelist[i]), REPORT_ERRORS, context)) { - add_next_index_unicodel(return_value, path, path_len, 0); - efree(namelist[i]); - } else { - /* Fallback on using the non-unicode version, path_decode will emit the warning for us */ - add_next_index_string(return_value, namelist[i], 0); - } + UChar *path; + int path_len; + + if (SUCCESS == php_stream_path_decode(NULL, &path, &path_len, namelist[i], strlen(namelist[i]), REPORT_ERRORS, context)) { + add_next_index_unicodel(return_value, path, path_len, 0); + efree(namelist[i]); } else { + /* Fallback on using the non-unicode version, path_decode will emit the warning for us */ add_next_index_string(return_value, namelist[i], 0); } } diff --git a/ext/standard/file.c b/ext/standard/file.c index 746142db61..495660ab71 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -620,7 +620,7 @@ PHP_FUNCTION(file_put_contents) int filename_len; zval *data; int numchars = 0; - long flags = ((argc < 3) && UG(unicode)) ? PHP_FILE_TEXT : 0; + long flags = (argc < 3) ? PHP_FILE_TEXT : 0; zval *zcontext = NULL; php_stream_context *context = NULL; char mode[3] = { 'w', 0, 0 }; @@ -938,18 +938,15 @@ PHP_FUNCTION(tempnam) } if ((fd = php_open_temporary_fd(dir, p, &opened_path TSRMLS_CC)) >= 0) { + UChar *utmpnam; + int utmpnam_len; + close(fd); - if (UG(unicode)) { - UChar *utmpnam; - int utmpnam_len; - if (SUCCESS == php_stream_path_decode(NULL, &utmpnam, &utmpnam_len, opened_path, strlen(opened_path), REPORT_ERRORS, FG(default_context))) { - RETVAL_UNICODEL(utmpnam, utmpnam_len, 0); - } - efree(opened_path); - } else { - RETVAL_STRING(opened_path, 0); + if (SUCCESS == php_stream_path_decode(NULL, &utmpnam, &utmpnam_len, opened_path, strlen(opened_path), REPORT_ERRORS, FG(default_context))) { + RETVAL_UNICODEL(utmpnam, utmpnam_len, 0); } + efree(opened_path); } efree(p); } @@ -2759,10 +2756,9 @@ PHP_FUNCTION(realpath) #ifdef ZTS if (VCWD_ACCESS(resolved_path_buff, F_OK)) { RETVAL_FALSE; - } else + } else #endif - - if (UG(unicode)) { + { UChar *path; int path_len; @@ -2772,8 +2768,6 @@ PHP_FUNCTION(realpath) /* Fallback */ RETVAL_STRING(resolved_path_buff, 1); } - } else { - RETVAL_STRING(resolved_path_buff, 1); } } else { RETVAL_FALSE; @@ -2936,10 +2930,6 @@ PHP_FUNCTION(sys_get_temp_dir) char *temp_dir = (char *)php_get_temporary_directory(); int temp_dir_len = strlen(temp_dir), utemp_dir_len; - if (!UG(unicode)) { - RETURN_STRINGL(temp_dir, temp_dir_len, 1); - } - /* else UG(unicode) */ if (FAILURE == php_stream_path_decode(NULL, &utemp_dir, &utemp_dir_len, temp_dir, temp_dir_len, REPORT_ERRORS, FG(default_context))) { RETURN_FALSE; diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c index c4152b954e..58b4ce113f 100644 --- a/ext/standard/formatted_print.c +++ b/ext/standard/formatted_print.c @@ -1272,18 +1272,11 @@ PHP_FUNCTION(user_sprintf) int len; zstr result; - if (!UG(unicode)) { - if ((result.s = php_formatted_print(ht, &len, 0, 0, PHP_RUNTIME TSRMLS_CC))==NULL) { - RETURN_FALSE; - } - RETVAL_STRINGL(result.s, len, 0); - } else { - result = php_u_formatted_print(ht, &len, 0, 0, PHP_RUNTIME TSRMLS_CC); - if (result.v == NULL) { - RETURN_FALSE; - } - RETVAL_UNICODEL(result.u, len, 0); + result = php_u_formatted_print(ht, &len, 0, 0, PHP_RUNTIME TSRMLS_CC); + if (result.v == NULL) { + RETURN_FALSE; } + RETVAL_UNICODEL(result.u, len, 0); } /* }}} */ @@ -1294,18 +1287,11 @@ PHP_FUNCTION(vsprintf) int len; zstr result; - if (!UG(unicode)) { - if ((result.s = php_formatted_print(ht, &len, 1, 0, PHP_RUNTIME TSRMLS_CC))==NULL) { - RETURN_FALSE; - } - RETVAL_STRINGL(result.s, len, 0); - } else { - result = php_u_formatted_print(ht, &len, 1, 0, PHP_RUNTIME TSRMLS_CC); - if (result.v == NULL) { - RETURN_FALSE; - } - RETVAL_UNICODEL(result.u, len, 0); + result = php_u_formatted_print(ht, &len, 1, 0, PHP_RUNTIME TSRMLS_CC); + if (result.v == NULL) { + RETURN_FALSE; } + RETVAL_UNICODEL(result.u, len, 0); } /* }}} */ @@ -1316,15 +1302,9 @@ PHP_FUNCTION(user_printf) int len; zstr result; - if (!UG(unicode)) { - if ((result.s = php_formatted_print(ht, &len, 0, 0, PHP_OUTPUT TSRMLS_CC))==NULL) { - RETURN_FALSE; - } - } else { - result = php_u_formatted_print(ht, &len, 0, 0, PHP_OUTPUT TSRMLS_CC); - if (result.v == NULL) { - RETURN_FALSE; - } + result = php_u_formatted_print(ht, &len, 0, 0, PHP_OUTPUT TSRMLS_CC); + if (result.v == NULL) { + RETURN_FALSE; } PHPWRITE(result.s, len); @@ -1339,16 +1319,10 @@ PHP_FUNCTION(vprintf) { int len; zstr result; - - if (!UG(unicode)) { - if ((result.s = php_formatted_print(ht, &len, 1, 0, PHP_OUTPUT TSRMLS_CC))==NULL) { - RETURN_FALSE; - } - } else { - result = php_u_formatted_print(ht, &len, 1, 0, PHP_OUTPUT TSRMLS_CC); - if (result.v == NULL) { - RETURN_FALSE; - } + + result = php_u_formatted_print(ht, &len, 1, 0, PHP_OUTPUT TSRMLS_CC); + if (result.v == NULL) { + RETURN_FALSE; } PHPWRITE(result.s, len); @@ -1377,7 +1351,7 @@ PHP_FUNCTION(fprintf) php_stream_from_zval(stream, &arg1); if (Z_TYPE_PP(arg2) != IS_STRING && Z_TYPE_PP(arg2) != IS_UNICODE) { - convert_to_text_ex(arg2); + convert_to_unicode_ex(arg2); } if (Z_TYPE_PP(arg2) == IS_STRING) { @@ -1419,7 +1393,7 @@ PHP_FUNCTION(vfprintf) php_stream_from_zval(stream, &arg1); if (Z_TYPE_PP(arg2) != IS_STRING && Z_TYPE_PP(arg2) != IS_UNICODE) { - convert_to_text_ex(arg2); + convert_to_unicode_ex(arg2); } if (Z_TYPE_PP(arg2) == IS_STRING) { diff --git a/ext/standard/head.c b/ext/standard/head.c index 31af492ed3..c0831bfd12 100644 --- a/ext/standard/head.c +++ b/ext/standard/head.c @@ -231,23 +231,17 @@ PHP_FUNCTION(headers_sent) case 2: zval_dtor(arg2); ZVAL_LONG(arg2, line); - case 1: - zval_dtor(arg1); - if (UG(unicode)) { + case 1: { UChar *ufile; int ufile_len; + zval_dtor(arg1); + if (file && SUCCESS == php_stream_path_decode(NULL, &ufile, &ufile_len, file, strlen(file), REPORT_ERRORS, FG(default_context))) { ZVAL_UNICODEL(arg1, ufile, ufile_len, 0); } else { ZVAL_EMPTY_UNICODE(arg1); } - } else { - if (file) { - ZVAL_STRING(arg1, file, 1); - } else { - ZVAL_STRING(arg1, "", 1); - } } break; } diff --git a/ext/standard/html.c b/ext/standard/html.c index 1a1c54821c..eeaf296599 100644 --- a/ext/standard/html.c +++ b/ext/standard/html.c @@ -1486,9 +1486,7 @@ PHP_FUNCTION(get_html_translation_table) return; } - if (UG(unicode)) { - charset = cs_utf_8; - } + charset = cs_utf_8; array_init(return_value); @@ -1505,18 +1503,11 @@ PHP_FUNCTION(get_html_translation_table) if (entity_map[j].table[i] == NULL) continue; - if (UG(unicode)) { - cp = (UChar)(i + entity_map[j].basechar); - key_len = zend_codepoint_to_uchar(cp, key); - key[key_len] = 0; - snprintf(buffer, sizeof(buffer), "&%s;", entity_map[j].table[i]); - add_u_assoc_ascii_string_ex(return_value, IS_UNICODE, ZSTR(key), key_len+1, buffer, 1); - } else { - /* no wide chars here, because charset is always cs_8859_1 */ - ind[0] = i + entity_map[j].basechar; - snprintf(buffer, sizeof(buffer), "&%s;", entity_map[j].table[i]); - add_assoc_string(return_value, ind, buffer, 1); - } + cp = (UChar)(i + entity_map[j].basechar); + key_len = zend_codepoint_to_uchar(cp, key); + key[key_len] = 0; + snprintf(buffer, sizeof(buffer), "&%s;", entity_map[j].table[i]); + add_u_assoc_ascii_string_ex(return_value, IS_UNICODE, ZSTR(key), key_len+1, buffer, 1); } } /* break thru */ diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index bda0d8a247..fd5b9cc1a1 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -637,7 +637,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, strlcpy(location, http_header_line + 10, sizeof(location)); } else if (!strncasecmp(http_header_line, "Content-Type: ", 14)) { - if (UG(unicode) && strchr(mode, 't')) { + if (strchr(mode, 't')) { charset = php_http_detect_charset(http_header_line + sizeof("Content-type: ")); } @@ -796,7 +796,7 @@ out: } if (charset) { - if (stream && UG(unicode) && strchr(mode, 't')) { + if (stream && strchr(mode, 't')) { php_stream_encoding_apply(stream, 0, charset, UG(to_error_mode), NULL); } efree(charset); diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c index 608dea0f72..ddbd7232c8 100644 --- a/ext/standard/incomplete_class.c +++ b/ext/standard/incomplete_class.c @@ -146,11 +146,7 @@ PHPAPI zstr php_lookup_class_name(zval *object, zend_uint *nlen) object_properties = Z_OBJPROP_P(object); if (zend_hash_find(object_properties, MAGIC_MEMBER, sizeof(MAGIC_MEMBER), (void **) &val) == SUCCESS) { - if (UG(unicode)) { - retval.u = eustrndup(Z_USTRVAL_PP(val), Z_USTRLEN_PP(val)); - } else { - retval.s = estrndup(Z_STRVAL_PP(val), Z_STRLEN_PP(val)); - } + retval.u = eustrndup(Z_USTRVAL_PP(val), Z_USTRLEN_PP(val)); if (nlen) { *nlen = Z_UNILEN_PP(val); diff --git a/ext/standard/link.c b/ext/standard/link.c index 0c89faae7a..8a79138ea9 100644 --- a/ext/standard/link.c +++ b/ext/standard/link.c @@ -80,14 +80,10 @@ PHP_FUNCTION(readlink) /* Append NULL to the end of the string */ buff[ret] = '\0'; - if (UG(unicode)) { - if (SUCCESS == php_stream_path_decode(NULL, &target, &target_len, buff, strlen(buff), REPORT_ERRORS, FG(default_context))) { - RETURN_UNICODEL(target, target_len, 0); - } else { - RETURN_FALSE; - } + if (SUCCESS == php_stream_path_decode(NULL, &target, &target_len, buff, strlen(buff), REPORT_ERRORS, FG(default_context))) { + RETURN_UNICODEL(target, target_len, 0); } else { - RETURN_STRING(buff, 1); + RETURN_FALSE; } } /* }}} */ diff --git a/ext/standard/php_incomplete_class.h b/ext/standard/php_incomplete_class.h index 46d7458d57..1cf0379778 100644 --- a/ext/standard/php_incomplete_class.h +++ b/ext/standard/php_incomplete_class.h @@ -33,11 +33,7 @@ class_name = php_lookup_class_name(struc, &name_len); \ if (!class_name.v) { \ name_len = sizeof(INCOMPLETE_CLASS) - 1; \ - if (UG(unicode)) { \ - class_name.u = USTR_MAKE(INCOMPLETE_CLASS); \ - } else { \ - class_name.s = estrndup(INCOMPLETE_CLASS, name_len); \ - } \ + class_name.u = USTR_MAKE(INCOMPLETE_CLASS); \ } \ free_class_name = 1; \ incomplete_class = 1; \ diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index b5ca427050..73b69ad393 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -317,6 +317,8 @@ PHP_FUNCTION(proc_get_status) int wstatus; pid_t wait_pid; #endif + UChar *ucmd; + int ucmd_len; int running = 1, signaled = 0, stopped = 0; int exitcode = -1, termsig = 0, stopsig = 0; @@ -328,17 +330,10 @@ PHP_FUNCTION(proc_get_status) array_init(return_value); - if (UG(unicode)) { - UChar *ucmd; - int ucmd_len; - - if (SUCCESS == php_stream_path_decode(&php_plain_files_wrapper, &ucmd, &ucmd_len, proc->command, strlen(proc->command), REPORT_ERRORS, FG(default_context))) { - add_ascii_assoc_unicodel(return_value, "command", ucmd, ucmd_len, 0); - } else { - /* Fallback on original binary string */ - add_ascii_assoc_string(return_value, "command", proc->command, 1); - } + if (SUCCESS == php_stream_path_decode(&php_plain_files_wrapper, &ucmd, &ucmd_len, proc->command, strlen(proc->command), REPORT_ERRORS, FG(default_context))) { + add_ascii_assoc_unicodel(return_value, "command", ucmd, ucmd_len, 0); } else { + /* Fallback on original binary string */ add_ascii_assoc_string(return_value, "command", proc->command, 1); } add_ascii_assoc_long(return_value, "pid", (long) proc->child); @@ -975,7 +970,7 @@ PHP_FUNCTION(proc_open) /* nasty hack; don't copy it */ stream->flags |= PHP_STREAM_FLAG_NO_SEEK; - if (UG(unicode) && !binary_pipes) { + if (!binary_pipes) { if (write_stream) { char *encoding = (context && context->output_encoding) ? context->output_encoding : UG(stream_encoding); diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index 41c067ed24..eb03b09b5c 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -542,17 +542,13 @@ PHP_FUNCTION(stream_get_meta_data) add_ascii_assoc_bool(return_value, "seekable", (stream->ops->seek) && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0); if (stream->orig_path) { - if (UG(unicode)) { - UChar *decoded_path = NULL; - int decoded_path_len = 0; - - if (SUCCESS == php_stream_path_decode(stream->wrapper, &decoded_path, &decoded_path_len, stream->orig_path, strlen(stream->orig_path), REPORT_ERRORS, stream->context)) { - add_ascii_assoc_unicodel(return_value, "uri", decoded_path, decoded_path_len, 0); - } else { - add_ascii_assoc_null(return_value, "uri"); - } + UChar *decoded_path = NULL; + int decoded_path_len = 0; + + if (SUCCESS == php_stream_path_decode(stream->wrapper, &decoded_path, &decoded_path_len, stream->orig_path, strlen(stream->orig_path), REPORT_ERRORS, stream->context)) { + add_ascii_assoc_unicodel(return_value, "uri", decoded_path, decoded_path_len, 0); } else { - add_ascii_assoc_string(return_value, "uri", stream->orig_path, 1); + add_ascii_assoc_null(return_value, "uri"); } } @@ -1684,6 +1680,8 @@ PHP_FUNCTION(stream_resolve_include_path) while (ptr < end) { char *s = strchr(ptr, DEFAULT_DIR_SEPARATOR); + UChar *upath; + int upath_len; if (!s) { s = end; @@ -1714,17 +1712,10 @@ PHP_FUNCTION(stream_resolve_include_path) continue; } - if (UG(unicode)) { - UChar *upath; - int upath_len; - - if (SUCCESS == php_stream_path_decode(NULL, &upath, &upath_len, buffer, (s - ptr) + 1 + filename_len, REPORT_ERRORS, context)) { - RETURN_UNICODEL(upath, upath_len, 0); - } else { - /* Fallback */ - RETURN_STRINGL(buffer, (s - ptr) + 1 + filename_len, 1); - } + if (SUCCESS == php_stream_path_decode(NULL, &upath, &upath_len, buffer, (s - ptr) + 1 + filename_len, REPORT_ERRORS, context)) { + RETURN_UNICODEL(upath, upath_len, 0); } else { + /* Fallback */ RETURN_STRINGL(buffer, (s - ptr) + 1 + filename_len, 1); } } diff --git a/ext/standard/string.c b/ext/standard/string.c index 6e93165d90..07faea8757 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -486,9 +486,7 @@ PHP_FUNCTION(nl_langinfo) return; } - if (UG(unicode)) { - php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "deprecated in Unicode mode, please use ICU locale functions"); - } + php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "deprecated in Unicode mode, please use ICU locale functions"); switch(item) { /* {{{ */ #ifdef ABDAY_1 @@ -1430,25 +1428,21 @@ PHP_FUNCTION(implode) SEPARATE_ZVAL(arg1); arr = *arg1; MAKE_STD_ZVAL(delim); - if (UG(unicode)) { - ZVAL_UNICODEL(delim, EMPTY_STR, sizeof("")-1, 0); - } else { - ZVAL_STRINGL(delim, "", sizeof("")-1, 0); - } + ZVAL_UNICODEL(delim, EMPTY_STR, sizeof("")-1, 0); } } else { if (Z_TYPE_PP(arg1) == IS_ARRAY) { SEPARATE_ZVAL(arg1); arr = *arg1; if (Z_TYPE_PP(arg2) != IS_UNICODE && Z_TYPE_PP(arg2) != IS_STRING) { - convert_to_text_ex(arg2); + convert_to_unicode_ex(arg2); } delim = *arg2; } else if (Z_TYPE_PP(arg2) == IS_ARRAY) { SEPARATE_ZVAL(arg2); arr = *arg2; if (Z_TYPE_PP(arg1) != IS_UNICODE && Z_TYPE_PP(arg1) != IS_STRING) { - convert_to_text_ex(arg1); + convert_to_unicode_ex(arg1); } delim = *arg1; } else { @@ -2348,7 +2342,7 @@ PHP_FUNCTION(stristr) SEPARATE_ZVAL(needle); if (Z_TYPE_PP(haystack) != IS_UNICODE && Z_TYPE_PP(haystack) != IS_STRING) { - convert_to_text_ex(haystack); + convert_to_unicode_ex(haystack); } if (Z_TYPE_PP(needle) == IS_UNICODE || Z_TYPE_PP(needle) == IS_STRING) { @@ -2634,7 +2628,7 @@ PHP_FUNCTION(stripos) } if (Z_TYPE_PP(haystack) != IS_UNICODE && Z_TYPE_PP(haystack) != IS_STRING) { - convert_to_text_ex(haystack); + convert_to_unicode_ex(haystack); } /* @@ -2746,7 +2740,7 @@ PHP_FUNCTION(strrpos) } if (Z_TYPE_PP(zhaystack) != IS_UNICODE && Z_TYPE_PP(zhaystack) != IS_STRING) { - convert_to_text_ex(zhaystack); + convert_to_unicode_ex(zhaystack); } if (Z_TYPE_PP(zneedle) == IS_UNICODE || Z_TYPE_PP(zneedle) == IS_STRING) { if (Z_TYPE_PP(zneedle) != Z_TYPE_PP(zhaystack)) { @@ -3040,7 +3034,7 @@ PHP_FUNCTION(strrchr) return; } if (Z_TYPE_P(haystack) != IS_UNICODE || Z_TYPE_P(haystack) != IS_STRING) { - convert_to_text(haystack); + convert_to_unicode(haystack); } if (Z_TYPE_P(needle) == IS_UNICODE || Z_TYPE_P(needle) == IS_STRING) { @@ -3395,11 +3389,11 @@ PHP_FUNCTION(substr_replace) if (Z_TYPE_PP(str) != IS_ARRAY && Z_TYPE_PP(str) != IS_UNICODE && Z_TYPE_PP(str) != IS_STRING) { - convert_to_text_ex(str); + convert_to_unicode_ex(str); } if (Z_TYPE_PP(repl) != IS_ARRAY && Z_TYPE_PP(repl) != IS_UNICODE && Z_TYPE_PP(repl) != IS_STRING) { - convert_to_text_ex(repl); + convert_to_unicode_ex(repl); } if (Z_TYPE_PP(from) != IS_ARRAY) { convert_to_long_ex(from); @@ -3439,7 +3433,7 @@ PHP_FUNCTION(substr_replace) zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(repl), &pos_repl); if (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(repl), (void **) &tmp_repl, &pos_repl)) { if (Z_TYPE_PP(repl) != IS_UNICODE && Z_TYPE_PP(repl) != IS_STRING) { - convert_to_text_ex(tmp_repl); + convert_to_unicode_ex(tmp_repl); } } else { tmp_repl = NULL; @@ -3483,7 +3477,7 @@ PHP_FUNCTION(substr_replace) zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(str), &pos_str); while (zend_hash_get_current_data_ex(Z_ARRVAL_PP(str), (void **) &tmp_str, &pos_str) == SUCCESS) { if (Z_TYPE_PP(tmp_str) != IS_UNICODE && Z_TYPE_PP(tmp_str) != IS_STRING) { - convert_to_text_ex(tmp_str); + convert_to_unicode_ex(tmp_str); } if (Z_TYPE_PP(from) == IS_ARRAY) { @@ -3514,7 +3508,7 @@ PHP_FUNCTION(substr_replace) if (Z_TYPE_PP(repl) == IS_ARRAY) { if (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(repl), (void **) &tmp_repl, &pos_repl)) { if (Z_TYPE_PP(tmp_repl) != IS_UNICODE && Z_TYPE_PP(tmp_repl) != IS_STRING) { - convert_to_text_ex(tmp_repl); + convert_to_unicode_ex(tmp_repl); } zend_hash_move_forward_ex(Z_ARRVAL_PP(repl), &pos_repl); } else { @@ -3646,6 +3640,8 @@ PHP_FUNCTION(ord) Converts a codepoint number to a character */ PHP_FUNCTION(chr) { + UChar buf[2]; + int buf_len; long num; char temp[2]; @@ -3653,22 +3649,12 @@ PHP_FUNCTION(chr) return; } - if (UG(unicode)) { - UChar buf[2]; - int buf_len; - - if (num > UCHAR_MAX_VALUE) { - php_error(E_WARNING, "Codepoint value cannot be greater than %X", UCHAR_MAX_VALUE); - return; - } - buf_len = zend_codepoint_to_uchar((uint32_t) num, buf); - RETURN_UNICODEL(buf, buf_len, 1); - } else { - temp[0] = (char) num; - temp[1] = 0; - - RETVAL_STRINGL(temp, 1, 1); + if (num > UCHAR_MAX_VALUE) { + php_error(E_WARNING, "Codepoint value cannot be greater than %X", UCHAR_MAX_VALUE); + return; } + buf_len = zend_codepoint_to_uchar((uint32_t) num, buf); + RETURN_UNICODEL(buf, buf_len, 1); } /* }}} */ @@ -5527,8 +5513,8 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval **subje int replace_len = 0; /* Make sure we're dealing with strings. */ - convert_to_text_ex(subject); - Z_TYPE_P(result) = ZEND_STR_TYPE; + convert_to_unicode_ex(subject); + Z_TYPE_P(result) = IS_UNICODE; if (Z_UNILEN_PP(subject) == 0) { ZVAL_EMPTY_TEXT(result); return; @@ -5555,7 +5541,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval **subje while (zend_hash_get_current_data(Z_ARRVAL_P(search), (void **) &search_entry) == SUCCESS) { /* Make sure we're dealing with strings. */ SEPARATE_ZVAL(search_entry); - convert_to_text(*search_entry); + convert_to_unicode(*search_entry); if (Z_UNILEN_PP(search_entry) == 0) { zend_hash_move_forward(Z_ARRVAL_P(search)); if (Z_TYPE_P(replace) == IS_ARRAY) { @@ -5570,7 +5556,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval **subje if (zend_hash_get_current_data(Z_ARRVAL_P(replace), (void **)&replace_entry) == SUCCESS) { /* Make sure we're dealing with strings. */ SEPARATE_ZVAL(replace_entry); - convert_to_text(*replace_entry); + convert_to_unicode(*replace_entry); /* Set replacement value to the one we got from array */ replace_value = Z_UNIVAL_PP(replace_entry); @@ -5585,42 +5571,28 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval **subje } if (Z_UNILEN_PP(search_entry) == 1) { - if (UG(unicode)) { - if (case_sensitivity) { - php_u_char_to_str_ex(Z_USTRVAL_P(result), Z_USTRLEN_P(result), - Z_USTRVAL_PP(search_entry)[0], - replace_value.u, replace_len, - &temp_result, replace_count); - } else { - Z_USTRVAL(temp_result) = php_u_str_to_str_case_ex(Z_USTRVAL_P(result), Z_USTRLEN_P(result), - Z_USTRVAL_PP(search_entry), Z_USTRLEN_PP(search_entry), - replace_value.u, replace_len, - &Z_USTRLEN(temp_result), replace_count TSRMLS_CC); - } + if (case_sensitivity) { + php_u_char_to_str_ex(Z_USTRVAL_P(result), Z_USTRLEN_P(result), + Z_USTRVAL_PP(search_entry)[0], + replace_value.u, replace_len, + &temp_result, replace_count); } else { - php_char_to_str_ex(Z_STRVAL_P(result), Z_STRLEN_P(result), - Z_STRVAL_PP(search_entry)[0], - replace_value.s, replace_len, - &temp_result, case_sensitivity, replace_count); + Z_USTRVAL(temp_result) = php_u_str_to_str_case_ex(Z_USTRVAL_P(result), Z_USTRLEN_P(result), + Z_USTRVAL_PP(search_entry), Z_USTRLEN_PP(search_entry), + replace_value.u, replace_len, + &Z_USTRLEN(temp_result), replace_count TSRMLS_CC); } } else if (Z_UNILEN_PP(search_entry) > 1) { - if (UG(unicode)) { - if (case_sensitivity) { - Z_USTRVAL(temp_result) = php_u_str_to_str_ex(Z_USTRVAL_P(result), Z_USTRLEN_P(result), - Z_USTRVAL_PP(search_entry), Z_USTRLEN_PP(search_entry), - replace_value.u, replace_len, - &Z_USTRLEN(temp_result), replace_count); - } else { - Z_USTRVAL(temp_result) = php_u_str_to_str_case_ex(Z_USTRVAL_P(result), Z_USTRLEN_P(result), - Z_USTRVAL_PP(search_entry), Z_USTRLEN_PP(search_entry), - replace_value.u, replace_len, - &Z_USTRLEN(temp_result), replace_count TSRMLS_CC); - } + if (case_sensitivity) { + Z_USTRVAL(temp_result) = php_u_str_to_str_ex(Z_USTRVAL_P(result), Z_USTRLEN_P(result), + Z_USTRVAL_PP(search_entry), Z_USTRLEN_PP(search_entry), + replace_value.u, replace_len, + &Z_USTRLEN(temp_result), replace_count); } else { - Z_STRVAL(temp_result) = php_str_to_str_ex(Z_STRVAL_P(result), Z_STRLEN_P(result), - Z_STRVAL_PP(search_entry), Z_STRLEN_PP(search_entry), - replace_value.s, replace_len, - &Z_STRLEN(temp_result), case_sensitivity, replace_count); + Z_USTRVAL(temp_result) = php_u_str_to_str_case_ex(Z_USTRVAL_P(result), Z_USTRLEN_P(result), + Z_USTRVAL_PP(search_entry), Z_USTRLEN_PP(search_entry), + replace_value.u, replace_len, + &Z_USTRLEN(temp_result), replace_count TSRMLS_CC); } } @@ -5636,42 +5608,28 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval **subje } } else { if (Z_UNILEN_P(search) == 1) { - if (UG(unicode)) { - if (case_sensitivity) { - php_u_char_to_str_ex(Z_USTRVAL_PP(subject), Z_USTRLEN_PP(subject), - Z_USTRVAL_P(search)[0], - Z_USTRVAL_P(replace), Z_USTRLEN_P(replace), - result, replace_count); - } else { - Z_USTRVAL_P(result) = php_u_str_to_str_case_ex(Z_USTRVAL_PP(subject), Z_USTRLEN_PP(subject), - Z_USTRVAL_P(search), Z_USTRLEN_P(search), - Z_USTRVAL_P(replace), Z_USTRLEN_P(replace), - &Z_USTRLEN_P(result), replace_count TSRMLS_CC); - } + if (case_sensitivity) { + php_u_char_to_str_ex(Z_USTRVAL_PP(subject), Z_USTRLEN_PP(subject), + Z_USTRVAL_P(search)[0], + Z_USTRVAL_P(replace), Z_USTRLEN_P(replace), + result, replace_count); } else { - php_char_to_str_ex(Z_STRVAL_PP(subject), Z_STRLEN_PP(subject), - Z_STRVAL_P(search)[0], - Z_STRVAL_P(replace), Z_STRLEN_P(replace), - result, case_sensitivity, replace_count); + Z_USTRVAL_P(result) = php_u_str_to_str_case_ex(Z_USTRVAL_PP(subject), Z_USTRLEN_PP(subject), + Z_USTRVAL_P(search), Z_USTRLEN_P(search), + Z_USTRVAL_P(replace), Z_USTRLEN_P(replace), + &Z_USTRLEN_P(result), replace_count TSRMLS_CC); } } else if (Z_STRLEN_P(search) > 1) { - if (UG(unicode)) { - if (case_sensitivity) { - Z_USTRVAL_P(result) = php_u_str_to_str_ex(Z_USTRVAL_PP(subject), Z_USTRLEN_PP(subject), - Z_USTRVAL_P(search), Z_USTRLEN_P(search), - Z_USTRVAL_P(replace), Z_USTRLEN_P(replace), - &Z_USTRLEN_P(result), replace_count); - } else { - Z_USTRVAL_P(result) = php_u_str_to_str_case_ex(Z_USTRVAL_PP(subject), Z_USTRLEN_PP(subject), - Z_USTRVAL_P(search), Z_USTRLEN_P(search), - Z_USTRVAL_P(replace), Z_USTRLEN_P(replace), - &Z_USTRLEN_P(result), replace_count TSRMLS_CC); - } + if (case_sensitivity) { + Z_USTRVAL_P(result) = php_u_str_to_str_ex(Z_USTRVAL_PP(subject), Z_USTRLEN_PP(subject), + Z_USTRVAL_P(search), Z_USTRLEN_P(search), + Z_USTRVAL_P(replace), Z_USTRLEN_P(replace), + &Z_USTRLEN_P(result), replace_count); } else { - Z_STRVAL_P(result) = php_str_to_str_ex(Z_STRVAL_PP(subject), Z_STRLEN_PP(subject), - Z_STRVAL_P(search), Z_STRLEN_P(search), - Z_STRVAL_P(replace), Z_STRLEN_P(replace), - &Z_STRLEN_P(result), case_sensitivity, replace_count); + Z_USTRVAL_P(result) = php_u_str_to_str_case_ex(Z_USTRVAL_PP(subject), Z_USTRLEN_PP(subject), + Z_USTRVAL_P(search), Z_USTRLEN_P(search), + Z_USTRVAL_P(replace), Z_USTRLEN_P(replace), + &Z_USTRLEN_P(result), replace_count TSRMLS_CC); } } else { *result = **subject; @@ -5701,10 +5659,10 @@ static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensit /* Make sure we're dealing with strings and do the replacement. */ if (Z_TYPE_P(search) != IS_ARRAY) { - convert_to_text(search); - convert_to_text(replace); + convert_to_unicode(search); + convert_to_unicode(replace); } else if (Z_TYPE_P(replace) != IS_ARRAY) { - convert_to_text(replace); + convert_to_unicode(replace); } /* if subject is an array */ @@ -6135,9 +6093,7 @@ PHP_FUNCTION(setlocale) return; } - if (UG(unicode)) { - php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "deprecated in Unicode mode, please use ICU locale functions"); - } + php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "deprecated in Unicode mode, please use ICU locale functions"); #ifdef HAVE_SETLOCALE if (Z_TYPE_PP(pcategory) == IS_LONG) { @@ -7047,7 +7003,7 @@ PHP_FUNCTION(count_chars) php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown mode"); RETURN_FALSE; } - if (UG(unicode) && mode != 1) { + if (mode != 1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only mode=1 is supported with Unicode strings"); RETURN_FALSE; } @@ -7175,9 +7131,7 @@ PHP_FUNCTION(localeconv) return; } - if (UG(unicode)) { - php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "deprecated in Unicode mode, please use ICU locale functions"); - } + php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "deprecated in Unicode mode, please use ICU locale functions"); MAKE_STD_ZVAL(grouping); MAKE_STD_ZVAL(mon_grouping); diff --git a/ext/standard/type.c b/ext/standard/type.c index 1cf73ecd7b..23aed02ee2 100644 --- a/ext/standard/type.c +++ b/ext/standard/type.c @@ -113,11 +113,7 @@ PHP_FUNCTION(settype) } else if (!strcasecmp(new_type, "binary")) { /* explicit binary cast */ convert_to_string(*var); } else if (!strcasecmp(new_type, "string")) { /* runtime string type */ - if (UG(unicode)) { - convert_to_unicode(*var); - } else { - convert_to_string(*var); - } + convert_to_unicode(*var); } else if (!strcasecmp(new_type, "unicode")) { /* explicit unicode cast */ convert_to_unicode(*var); } else if (!strcasecmp(new_type, "array")) { @@ -189,11 +185,7 @@ PHP_FUNCTION(strval) return; } - if (UG(unicode)) { - zend_make_unicode_zval(*num, &expr_copy, &use_copy); - } else { - zend_make_string_zval(*num, &expr_copy, &use_copy); - } + zend_make_unicode_zval(*num, &expr_copy, &use_copy); if (use_copy) { tmp = &expr_copy; RETVAL_ZVAL(tmp, 0, 0); @@ -224,7 +216,7 @@ static void php_is_type(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */ if (ce->name_length != sizeof(INCOMPLETE_CLASS) - 1) { /* We can get away with this because INCOMPLETE_CLASS is ascii and has a 1:1 relationship with unicode */ RETURN_TRUE; - } else if (UG(unicode)) { + } else { #ifndef PHP_WIN32 U_STRING_DECL(uIncompleteClass, (INCOMPLETE_CLASS), sizeof(INCOMPLETE_CLASS) - 1); U_STRING_INIT(uIncompleteClass, (INCOMPLETE_CLASS), sizeof(INCOMPLETE_CLASS) - 1); @@ -244,10 +236,6 @@ static void php_is_type(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */ } /* Non-ascii class name means it can't be INCOMPLETE_CLASS and is therefore okay */ #endif - } else { - if (!memcmp(ce->name.s, INCOMPLETE_CLASS, sizeof(INCOMPLETE_CLASS))) { - RETURN_FALSE; - } } } if (type == IS_RESOURCE) { diff --git a/ext/standard/uniqid.c b/ext/standard/uniqid.c index 26e06d1a59..2c874ed9d6 100644 --- a/ext/standard/uniqid.c +++ b/ext/standard/uniqid.c @@ -45,7 +45,7 @@ PHP_FUNCTION(uniqid) { zstr prefix = EMPTY_ZSTR; int prefix_len = 0; - zend_uchar str_type = ZEND_STR_TYPE; + zend_uchar str_type = IS_UNICODE; #if defined(__CYGWIN__) zend_bool more_entropy = 1; #else diff --git a/ext/standard/var.c b/ext/standard/var.c index 01ea9cf0af..d097063020 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -777,11 +777,7 @@ static inline zend_bool php_var_serialize_class_name(smart_str *buf, zval *struc smart_str_appendl(buf, "O:", 2); smart_str_append_long(buf, name_len); smart_str_appendl(buf, ":\"", 2); - if (UG(unicode)) { - php_var_serialize_ustr(buf, class_name.u, name_len); - } else { - smart_str_appendl(buf, class_name.s, name_len); - } + php_var_serialize_ustr(buf, class_name.u, name_len); smart_str_appendl(buf, "\":", 2); PHP_CLEANUP_CLASS_ATTRIBUTES(); return incomplete_class; @@ -835,7 +831,7 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt } zend_hash_get_current_data_ex(HASH_OF(retval_ptr), (void **) &name, &pos); - if (Z_TYPE_PP(name) != (UG(unicode) ? IS_UNICODE : IS_STRING)) { + if (Z_TYPE_PP(name) != IS_UNICODE) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "__sleep should return an array only containing the names of instance-variables to serialize"); /* we should still add element even if it's not OK, * since we already wrote the length of the array before */ @@ -980,13 +976,7 @@ static void php_var_serialize_intern(smart_str *buf, zval *struc, HashTable *var smart_str_appendl(buf, "C:", 2); smart_str_append_long(buf, Z_OBJCE_P(struc)->name_length); smart_str_appendl(buf, ":\"", 2); - - if (UG(unicode)) { - php_var_serialize_ustr(buf, Z_OBJCE_P(struc)->name.u, Z_OBJCE_P(struc)->name_length); - } else { - smart_str_appendl(buf, Z_OBJCE_P(struc)->name.s, Z_OBJCE_P(struc)->name_length); - } - + php_var_serialize_ustr(buf, Z_OBJCE_P(struc)->name.u, Z_OBJCE_P(struc)->name_length); smart_str_appendl(buf, "\":", 2); smart_str_append_long(buf, serialized_length); @@ -1143,9 +1133,7 @@ PHP_FUNCTION(serialize) if (buf.c) { RETVAL_ASCII_STRINGL(buf.c, buf.len, 0); - if (UG(unicode)) { - smart_str_free(&buf); - } + smart_str_free(&buf); } else { RETURN_NULL(); } diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c index aed5e061dd..edb69241f7 100644 --- a/ext/standard/var_unserializer.c +++ b/ext/standard/var_unserializer.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Tue Mar 17 16:18:00 2009 */ +/* Generated by re2c 0.13.5 on Thu Mar 26 15:18:13 2009 */ #line 1 "ext/standard/var_unserializer.re" /* +----------------------------------------------------------------------+ @@ -522,7 +522,7 @@ yy2: yych = *(YYMARKER = ++YYCURSOR); if (yych == ':') goto yy103; yy3: -#line 817 "ext/standard/var_unserializer.re" +#line 807 "ext/standard/var_unserializer.re" { return 0; } #line 528 "ext/standard/var_unserializer.c" yy4: @@ -571,7 +571,7 @@ yy14: goto yy3; yy15: ++YYCURSOR; -#line 811 "ext/standard/var_unserializer.re" +#line 801 "ext/standard/var_unserializer.re" { /* this is the case where we have less data than planned */ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unexpected end of serialized data"); @@ -635,17 +635,7 @@ yy21: return 0; } - if (UG(unicode)) { - class_name.u = unserialize_ustr(&YYCURSOR, len); - } else { - len3 = strspn((char*)YYCURSOR, "0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377:"); - if (len3 != len) { - *p = YYCURSOR + len3 - len; - return 0; - } - class_name.s = estrndup((char*)YYCURSOR, len); - YYCURSOR += len; - } + class_name.u = unserialize_ustr(&YYCURSOR, len); if (*(YYCURSOR) != '"') { efree(class_name.v); @@ -660,7 +650,7 @@ yy21: do { /* Try to find class directly */ - if (zend_u_lookup_class(UG(unicode)?IS_UNICODE:IS_STRING, class_name, len2, &pce TSRMLS_CC) == SUCCESS) { + if (zend_u_lookup_class(IS_UNICODE, class_name, len2, &pce TSRMLS_CC) == SUCCESS) { ce = *pce; break; } @@ -691,7 +681,7 @@ yy21: } /* The callback function may have defined the class */ - if (zend_u_lookup_class(UG(unicode)?IS_UNICODE:IS_STRING, class_name, len2, &pce TSRMLS_CC) == SUCCESS) { + if (zend_u_lookup_class(IS_UNICODE, class_name, len2, &pce TSRMLS_CC) == SUCCESS) { ce = *pce; } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Function %s() hasn't defined the class it was called for", user_func->value.str.val); @@ -725,7 +715,7 @@ yy21: return object_common2(UNSERIALIZE_PASSTHRU, elements); } -#line 729 "ext/standard/var_unserializer.c" +#line 719 "ext/standard/var_unserializer.c" yy26: yych = *++YYCURSOR; if (yych <= ',') { @@ -758,7 +748,7 @@ yy28: return object_common2(UNSERIALIZE_PASSTHRU, object_common1(UNSERIALIZE_PASSTHRU, ZEND_STANDARD_CLASS_DEF_PTR)); } -#line 762 "ext/standard/var_unserializer.c" +#line 752 "ext/standard/var_unserializer.c" yy33: yych = *++YYCURSOR; if (yych == '+') goto yy34; @@ -799,7 +789,7 @@ yy35: return finish_nested_data(UNSERIALIZE_PASSTHRU); } -#line 803 "ext/standard/var_unserializer.c" +#line 793 "ext/standard/var_unserializer.c" yy40: yych = *++YYCURSOR; if (yych == '+') goto yy41; @@ -849,7 +839,7 @@ yy42: ZVAL_UNICODEL(*rval, ustr, len, 0); return 1; } -#line 853 "ext/standard/var_unserializer.c" +#line 843 "ext/standard/var_unserializer.c" yy47: yych = *++YYCURSOR; if (yych == '+') goto yy48; @@ -899,7 +889,7 @@ yy49: ZVAL_STRINGL(*rval, str, len, 0); return 1; } -#line 903 "ext/standard/var_unserializer.c" +#line 893 "ext/standard/var_unserializer.c" yy54: yych = *++YYCURSOR; if (yych == '+') goto yy55; @@ -948,7 +938,7 @@ yy56: ZVAL_STRINGL(*rval, str, len, 1); return 1; } -#line 952 "ext/standard/var_unserializer.c" +#line 942 "ext/standard/var_unserializer.c" yy61: yych = *++YYCURSOR; if (yych <= '/') { @@ -1046,7 +1036,7 @@ use_double: ZVAL_DOUBLE(*rval, zend_strtod((const char *)start + 2, NULL)); return 1; } -#line 1050 "ext/standard/var_unserializer.c" +#line 1040 "ext/standard/var_unserializer.c" yy73: yych = *++YYCURSOR; if (yych <= ',') { @@ -1120,7 +1110,7 @@ yy81: return 1; } -#line 1124 "ext/standard/var_unserializer.c" +#line 1114 "ext/standard/var_unserializer.c" yy84: yych = *++YYCURSOR; if (yych == 'N') goto yy81; @@ -1174,7 +1164,7 @@ yy87: ZVAL_LONG(*rval, parse_iv(start + 2)); return 1; } -#line 1178 "ext/standard/var_unserializer.c" +#line 1168 "ext/standard/var_unserializer.c" yy91: yych = *++YYCURSOR; if (yych <= '/') goto yy19; @@ -1189,7 +1179,7 @@ yy91: ZVAL_BOOL(*rval, parse_iv(start + 2)); return 1; } -#line 1193 "ext/standard/var_unserializer.c" +#line 1183 "ext/standard/var_unserializer.c" yy95: ++YYCURSOR; #line 513 "ext/standard/var_unserializer.re" @@ -1199,7 +1189,7 @@ yy95: ZVAL_NULL(*rval); return 1; } -#line 1203 "ext/standard/var_unserializer.c" +#line 1193 "ext/standard/var_unserializer.c" yy97: yych = *++YYCURSOR; if (yych <= ',') { @@ -1245,7 +1235,7 @@ yy99: return 1; } -#line 1249 "ext/standard/var_unserializer.c" +#line 1239 "ext/standard/var_unserializer.c" yy103: yych = *++YYCURSOR; if (yych <= ',') { @@ -1289,9 +1279,9 @@ yy105: return 1; } -#line 1293 "ext/standard/var_unserializer.c" +#line 1283 "ext/standard/var_unserializer.c" } -#line 819 "ext/standard/var_unserializer.re" +#line 809 "ext/standard/var_unserializer.re" return 0; diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re index 943a809593..06eb6e234a 100644 --- a/ext/standard/var_unserializer.re +++ b/ext/standard/var_unserializer.re @@ -717,17 +717,7 @@ object ":" uiv ":" ["] { return 0; } - if (UG(unicode)) { - class_name.u = unserialize_ustr(&YYCURSOR, len); - } else { - len3 = strspn((char*)YYCURSOR, "0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377:"); - if (len3 != len) { - *p = YYCURSOR + len3 - len; - return 0; - } - class_name.s = estrndup((char*)YYCURSOR, len); - YYCURSOR += len; - } + class_name.u = unserialize_ustr(&YYCURSOR, len); if (*(YYCURSOR) != '"') { efree(class_name.v); @@ -742,7 +732,7 @@ object ":" uiv ":" ["] { do { /* Try to find class directly */ - if (zend_u_lookup_class(UG(unicode)?IS_UNICODE:IS_STRING, class_name, len2, &pce TSRMLS_CC) == SUCCESS) { + if (zend_u_lookup_class(IS_UNICODE, class_name, len2, &pce TSRMLS_CC) == SUCCESS) { ce = *pce; break; } @@ -773,7 +763,7 @@ object ":" uiv ":" ["] { } /* The callback function may have defined the class */ - if (zend_u_lookup_class(UG(unicode)?IS_UNICODE:IS_STRING, class_name, len2, &pce TSRMLS_CC) == SUCCESS) { + if (zend_u_lookup_class(IS_UNICODE, class_name, len2, &pce TSRMLS_CC) == SUCCESS) { ce = *pce; } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Function %s() hasn't defined the class it was called for", user_func->value.str.val); diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c index a13eb61102..7cdcc17500 100644 --- a/ext/tidy/tidy.c +++ b/ext/tidy/tidy.c @@ -862,11 +862,7 @@ static void tidy_doc_update_properties(PHPTidyObj *obj TSRMLS_DC) if (output.size) { MAKE_STD_ZVAL(temp); - if (UG(unicode)) { - ZVAL_U_STRINGL(obj->converter->conv, temp, (char *) output.bp, output.size-1, 1); - } else { - ZVAL_STRINGL(temp, (char *) output.bp, output.size-1, 1); - } + ZVAL_U_STRINGL(obj->converter->conv, temp, (char *) output.bp, output.size-1, 1); zend_ascii_hash_update(obj->std.properties, "value", sizeof("value"), (void *)&temp, sizeof(zval *), NULL); } @@ -1091,11 +1087,9 @@ static int php_tidy_parse_string(PHPTidyObj *obj, char *string, int len, char *e } } - if (UG(unicode)) { - obj->converter = emalloc(sizeof(PHPTidyConv)); - obj->converter->conv = ucnv_open(tidyOptGetEncName(obj->ptdoc->doc, TidyOutCharEncoding), &Uerror); - obj->converter->ref_count = 1; - } + obj->converter = emalloc(sizeof(PHPTidyConv)); + obj->converter->conv = ucnv_open(tidyOptGetEncName(obj->ptdoc->doc, TidyOutCharEncoding), &Uerror); + obj->converter->ref_count = 1; tidyBufInit(&buf); tidyBufAttach(&buf, (byte *) string, len); diff --git a/ext/tokenizer/tokenizer.c b/ext/tokenizer/tokenizer.c index 2d9aa32be9..abd87b168c 100644 --- a/ext/tokenizer/tokenizer.c +++ b/ext/tokenizer/tokenizer.c @@ -107,7 +107,7 @@ static void tokenize(zval *return_value TSRMLS_DC) zend_bool destroy; int token_line = 1; - CG(literal_type) = UG(unicode)?IS_UNICODE:IS_STRING; + CG(literal_type) = IS_UNICODE; array_init(return_value); diff --git a/ext/xml/xml.c b/ext/xml/xml.c index d75cc17f38..3f4770d38b 100644 --- a/ext/xml/xml.c +++ b/ext/xml/xml.c @@ -413,12 +413,7 @@ static zval *_xml_xmlchar_zval(const XML_Char *s, int len, const XML_Char *encod len = _xml_xmlcharlen(s); } - if (UG(unicode)) { - ZVAL_UTF8_STRINGL(ret, (char *)s, len, ZSTR_DUPLICATE); - } else { - Z_TYPE_P(ret) = IS_STRING; - Z_STRVAL_P(ret) = xml_utf8_decode(s, len, &Z_STRLEN_P(ret), encoding); - } + ZVAL_UTF8_STRINGL(ret, (char *)s, len, ZSTR_DUPLICATE); return ret; } @@ -492,7 +487,7 @@ static void xml_set_handler(zval **handler, zval **data TSRMLS_DC) /* IS_ARRAY might indicate that we're using array($obj, 'method') syntax */ if (Z_TYPE_PP(data) != IS_ARRAY && Z_TYPE_PP(data) != IS_OBJECT) { - convert_to_text_ex(data); + convert_to_unicode_ex(data); if (((Z_TYPE_PP(data)==IS_UNICODE) && (Z_USTRLEN_PP(data) == 0)) || ((Z_TYPE_PP(data)==IS_STRING) && (Z_STRLEN_PP(data) == 0))) { @@ -791,11 +786,7 @@ static char *_xml_decode_tag(xml_parser *parser, const char *tag) TSRMLS_FETCH(); - if (UG(unicode)) { - newstr = xml_utf8_decode(tag, strlen(tag), &out_len, NULL); - } else { - newstr = xml_utf8_decode(tag, strlen(tag), &out_len, parser->target_encoding); - } + newstr = xml_utf8_decode(tag, strlen(tag), &out_len, NULL); if (parser->case_folding) { php_strtoupper(newstr, out_len); @@ -830,11 +821,7 @@ void _xml_startElementHandler(void *userData, const XML_Char *name, const XML_Ch while (attributes && *attributes) { att = _xml_decode_tag(parser, attributes[0]); - if (UG(unicode)) { - val = xml_utf8_decode(attributes[1], strlen(attributes[1]), &val_len, NULL); - } else { - val = xml_utf8_decode(attributes[1], strlen(attributes[1]), &val_len, parser->target_encoding); - } + val = xml_utf8_decode(attributes[1], strlen(attributes[1]), &val_len, NULL); add_utf8_assoc_utf8_stringl(args[2], att, val, val_len, ZSTR_AUTOFREE); @@ -871,11 +858,7 @@ void _xml_startElementHandler(void *userData, const XML_Char *name, const XML_Ch while (attributes && *attributes) { att = _xml_decode_tag(parser, attributes[0]); - if (UG(unicode)) { - val = xml_utf8_decode(attributes[1], strlen(attributes[1]), &val_len, NULL); - } else { - val = xml_utf8_decode(attributes[1], strlen(attributes[1]), &val_len, parser->target_encoding); - } + val = xml_utf8_decode(attributes[1], strlen(attributes[1]), &val_len, NULL); add_utf8_assoc_utf8_stringl(atr, att, val, val_len, ZSTR_AUTOFREE); @@ -979,11 +962,7 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len) TSRMLS_FETCH(); - if (UG(unicode)) { - decoded_value = xml_utf8_decode(s,len,&decoded_len,NULL); - } else { - decoded_value = xml_utf8_decode(s,len,&decoded_len,parser->target_encoding); - } + decoded_value = xml_utf8_decode(s,len,&decoded_len,NULL); for (i = 0; i < decoded_len; i++) { switch (decoded_value[i]) { case ' ': @@ -1812,11 +1791,7 @@ PHP_FUNCTION(utf8_decode) if (data_type == IS_UNICODE) { RETURN_UNICODEL(data, data_len, 1); } - if (UG(unicode)) { - decoded = xml_utf8_decode(data, data_len, &len, NULL); - } else { - decoded = xml_utf8_decode(data, data_len, &len, "ISO-8859-1"); - } + decoded = xml_utf8_decode(data, data_len, &len, NULL); if (decoded == NULL) { RETURN_FALSE; diff --git a/ext/xmlreader/php_xmlreader.c b/ext/xmlreader/php_xmlreader.c index 252c95ba44..b6d0f32f57 100644 --- a/ext/xmlreader/php_xmlreader.c +++ b/ext/xmlreader/php_xmlreader.c @@ -124,7 +124,7 @@ zval **xmlreader_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC) if (member->type != IS_STRING && member->type != IS_UNICODE) { tmp_member = *member; zval_copy_ctor(&tmp_member); - convert_to_text(&tmp_member); + convert_to_unicode(&tmp_member); member = &tmp_member; } @@ -158,7 +158,7 @@ zval *xmlreader_read_property(zval *object, zval *member, int type TSRMLS_DC) if (member->type != IS_STRING && member->type != IS_UNICODE) { tmp_member = *member; zval_copy_ctor(&tmp_member); - convert_to_text(&tmp_member); + convert_to_unicode(&tmp_member); member = &tmp_member; } @@ -200,7 +200,7 @@ void xmlreader_write_property(zval *object, zval *member, zval *value TSRMLS_DC) if (member->type != IS_STRING && member->type != IS_UNICODE) { tmp_member = *member; zval_copy_ctor(&tmp_member); - convert_to_text(&tmp_member); + convert_to_unicode(&tmp_member); member = &tmp_member; } diff --git a/main/SAPI.c b/main/SAPI.c index 8529ca5a96..56b46fff25 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -227,19 +227,15 @@ SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data) /* {{{ sapi_update_default_charset */ SAPI_API void sapi_update_default_charset(TSRMLS_D) { - if (UG(unicode)) { - const char *canonical_name = NULL; - UErrorCode status = U_ZERO_ERROR; - - canonical_name = ucnv_getName(ZEND_U_CONVERTER(UG(output_encoding_conv)), &status); - /* - * UTODO handle NULL return which signifies that MIME standard has no - * name for this converter - */ - SG(default_charset) = (char *)ucnv_getStandardName(canonical_name, "MIME", &status); - } else { - SG(default_charset) = zend_ini_string("default_charset", sizeof("default_charset"), 0); - } + const char *canonical_name = NULL; + UErrorCode status = U_ZERO_ERROR; + + canonical_name = ucnv_getName(ZEND_U_CONVERTER(UG(output_encoding_conv)), &status); + /* + * UTODO handle NULL return which signifies that MIME standard has no + * name for this converter + */ + SG(default_charset) = (char *)ucnv_getStandardName(canonical_name, "MIME", &status); } /* }}} */ diff --git a/main/php_variables.c b/main/php_variables.c index 4900dbb859..1c860081b2 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -403,43 +403,28 @@ SAPI_API SAPI_POST_HANDLER_FUNC(php_std_post_handler) while (s < e && (p = memchr(s, '&', (e - s)))) { last_value: if ((val = memchr(s, '=', (p - s)))) { /* have a value */ - if (UG(unicode)) { - UChar *u_var, *u_val; - int u_var_len, u_val_len; - int var_len; - int val_len; - UErrorCode status1 = U_ZERO_ERROR, status2 = U_ZERO_ERROR; - - var = s; - var_len = val - s; - - php_url_decode(var, var_len); - val++; - val_len = php_url_decode(val, (p - val)); - zend_string_to_unicode_ex(input_conv, &u_var, &u_var_len, var, var_len, &status1); - zend_string_to_unicode_ex(input_conv, &u_val, &u_val_len, val, val_len, &status2); - if (U_SUCCESS(status1) && U_SUCCESS(status2)) { - /* UTODO add input filtering */ - php_u_register_variable_safe(u_var, u_val, u_val_len, array_ptr TSRMLS_CC); - } else { - /* UTODO set a user-accessible flag to indicate that conversion failed? */ - } - efree(u_var); - efree(u_val); + UChar *u_var, *u_val; + int u_var_len, u_val_len; + int var_len; + int val_len; + UErrorCode status1 = U_ZERO_ERROR, status2 = U_ZERO_ERROR; + + var = s; + var_len = val - s; + + php_url_decode(var, var_len); + val++; + val_len = php_url_decode(val, (p - val)); + zend_string_to_unicode_ex(input_conv, &u_var, &u_var_len, var, var_len, &status1); + zend_string_to_unicode_ex(input_conv, &u_val, &u_val_len, val, val_len, &status2); + if (U_SUCCESS(status1) && U_SUCCESS(status2)) { + /* UTODO add input filtering */ + php_u_register_variable_safe(u_var, u_val, u_val_len, array_ptr TSRMLS_CC); } else { - unsigned int val_len, new_val_len; - - var = s; - - php_url_decode(var, (val - s)); - val++; - val_len = php_url_decode(val, (p - val)); - val = estrndup(val, val_len); - if (sapi_module.input_filter(PARSE_POST, var, &val, val_len, &new_val_len TSRMLS_CC)) { - php_register_variable_safe(var, val, new_val_len, array_ptr TSRMLS_CC); - } - efree(val); + /* UTODO set a user-accessible flag to indicate that conversion failed? */ } + efree(u_var); + efree(u_val); } s = p + 1; } @@ -565,51 +550,38 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data) var_len = strlen(var); php_url_decode(var, var_len); - if (UG(unicode)) { - UChar *u_var, *u_val; - int u_var_len, u_val_len; - UErrorCode status = U_ZERO_ERROR; + UChar *u_var, *u_val; + int u_var_len, u_val_len; + UErrorCode status = U_ZERO_ERROR; + + zend_string_to_unicode_ex(input_conv, &u_var, &u_var_len, var, var_len, &status); + if (U_FAILURE(status)) { + /* UTODO set a user-accessible flag to indicate that conversion failed? */ + efree(u_var); + goto next_var; + } - zend_string_to_unicode_ex(input_conv, &u_var, &u_var_len, var, var_len, &status); + if (val) { /* have a value */ + int val_len; + /* unsigned int new_val_len; see below */ + + val_len = php_url_decode(val, strlen(val)); + zend_string_to_unicode_ex(input_conv, &u_val, &u_val_len, val, val_len, &status); if (U_FAILURE(status)) { /* UTODO set a user-accessible flag to indicate that conversion failed? */ efree(u_var); + efree(u_val); goto next_var; } - - if (val) { /* have a value */ - int val_len; - /* unsigned int new_val_len; see below */ - - val_len = php_url_decode(val, strlen(val)); - zend_string_to_unicode_ex(input_conv, &u_val, &u_val_len, val, val_len, &status); - if (U_FAILURE(status)) { - /* UTODO set a user-accessible flag to indicate that conversion failed? */ - efree(u_var); - efree(u_val); - goto next_var; - } - php_u_register_variable_safe(u_var, u_val, u_val_len, array_ptr TSRMLS_CC); - /* UTODO need to make input_filter Unicode aware */ - /* - if (sapi_module.input_filter(arg, var, &val, val_len, &new_val_len TSRMLS_CC)) { - php_register_variable_safe(var, val, new_val_len, array_ptr TSRMLS_CC); - } - */ - efree(u_var); - efree(u_val); - } else { - u_val_len = 0; - u_val = USTR_MAKE(""); - php_u_register_variable_safe(u_var, u_val, u_val_len, array_ptr TSRMLS_CC); - /* - if (sapi_module.input_filter(arg, var, &val, val_len, &new_val_len TSRMLS_CC)) { - php_register_variable_safe(var, val, new_val_len, array_ptr TSRMLS_CC); - } - */ - efree(u_var); - efree(u_val); + php_u_register_variable_safe(u_var, u_val, u_val_len, array_ptr TSRMLS_CC); + /* UTODO need to make input_filter Unicode aware */ + /* + if (sapi_module.input_filter(arg, var, &val, val_len, &new_val_len TSRMLS_CC)) { + php_register_variable_safe(var, val, new_val_len, array_ptr TSRMLS_CC); } + */ + efree(u_var); + efree(u_val); } else { if (val) { /* have a value */ int val_len; diff --git a/main/rfc1867.c b/main/rfc1867.c index 205dc14409..80a92d632a 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -2160,11 +2160,7 @@ fileupload_done: SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) { - if (UG(unicode)) { - rfc1867_post_handler_unicode(content_type_dup, arg TSRMLS_CC); - } else { - rfc1867_post_handler_legacy(content_type_dup, arg TSRMLS_CC); - } + rfc1867_post_handler_unicode(content_type_dup, arg TSRMLS_CC); } /* diff --git a/main/spprintf.c b/main/spprintf.c index f3601206ee..477dddb721 100644 --- a/main/spprintf.c +++ b/main/spprintf.c @@ -605,11 +605,7 @@ static void xbuf_format_converter(int unicode, smart_str *xbuf, const char *fmt, break; case 'v': - if (UG(unicode)) { - goto fmt_unicode; - } else { - goto fmt_string; - } + goto fmt_unicode; break; case 'R': diff --git a/main/streams/streams.c b/main/streams/streams.c index 0724eea312..490242429d 100755 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -2358,7 +2358,7 @@ PHPAPI php_stream_dirent *_php_stream_readdir(php_stream *dirstream, php_stream_ PHPAPI void php_stream_fix_encoding(php_stream *stream, const char *mode, php_stream_context *context TSRMLS_DC) { /* Output encoding on text mode streams defaults to utf8 unless specified in context parameter */ - if (stream && strchr(mode, 't') && UG(unicode)) { + if (stream && strchr(mode, 't')) { /* Only apply implicit unicode.to. filter if the wrapper didn't do it for us */ if ((php_stream_filter_product(&stream->writefilters, IS_UNICODE) == IS_UNICODE) && (strchr(mode, 'w') || strchr(mode, 'a') || strchr(mode, '+'))) { |