Re: Re: Focus on HEAD
| From: | Steph Fox | Date: | Mon, 09 Jun 2008 17:55:24 +0000 |
| Subject: | Re: Re: Focus on HEAD | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-38121@lists.php.net to get a copy of this message | ||
Hi all,
Andrei doesn't have time to review this lot (covers ext/standard). Could someone please check it for clangers?
Thanks,
- Steph
Sure. Steph Fox wrote:Is there a patch that does that? I'm fine with removing these checks.If there isn't already, there soon will be :) Did you want to review it prior to commit? - Steph
Index: ext/standard/array.c =================================================================== RCS file: /repository/php-src/ext/standard/array.c,v retrieving revision 1.454 diff -u -r1.454 array.c --- ext/standard/array.c 2 Jun 2008 11:20:17 -0000 1.454 +++ ext/standard/array.c 9 Jun 2008 10:56:45 -0000 @@ -1314,67 +1314,35 @@ { 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)); - - 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); - } + 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 (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)); - - if (add_underscore) { - Z_STRVAL_P(result)[Z_STRLEN_P(prefix)] = '_'; - } - - 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); + 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); } return SUCCESS; @@ -1413,7 +1381,7 @@ } 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; @@ -1447,7 +1415,7 @@ 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 { @@ -1503,10 +1471,8 @@ 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))) { @@ -1698,7 +1664,7 @@ 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; } @@ -4563,7 +4529,7 @@ } RETURN_FALSE; case IS_NULL: - if (zend_u_hash_exists(HASH_OF(array), (UG(unicode) ? IS_UNICODE : IS_STRING), EMPTY_ZSTR, 1)) { + if (zend_u_hash_exists(HASH_OF(array), IS_UNICODE, EMPTY_ZSTR, 1)) { RETURN_TRUE; } RETURN_FALSE; @@ -4698,7 +4664,7 @@ 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; } Index: ext/standard/basic_functions.c =================================================================== RCS file: /repository/php-src/ext/standard/basic_functions.c,v retrieving revision 1.900 diff -u -r1.900 basic_functions.c --- ext/standard/basic_functions.c 24 May 2008 14:36:16 -0000 1.900 +++ ext/standard/basic_functions.c 9 Jun 2008 11:02:49 -0000 @@ -5162,7 +5162,7 @@ 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) { @@ -5196,7 +5196,7 @@ RETURN_FALSE; } - convert_to_text(callback); + convert_to_unicode(callback); params_ar = HASH_OF(params); num_elems = zend_hash_num_elements(params_ar); @@ -5603,7 +5603,7 @@ 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); @@ -5862,15 +5862,14 @@ } /* We always want to convert IS_UNICODE to UTF-8 and pass to INI subsystem. - * For binary strings, however, we want to convert only if UG(unicode) is - * on, in which case we check whether filesystem encoding is already UTF-8, - * and if it's not, we convert from that to UTF-8. */ + * For binary strings, however, we need to check whether filesystem encoding + * is already UTF-8, and if it's not, we convert from that to UTF-8. */ if (type == IS_UNICODE) { zend_unicode_to_string(UG(utf8_conv), &temp, &temp_len, new_value.u, new_value_len TSRMLS_CC); 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) { @@ -6110,7 +6109,7 @@ } if (Z_TYPE_P(tick_fe.arguments[0]) != IS_ARRAY) { - convert_to_text_ex(&tick_fe.arguments[0]); + convert_to_unicode_ex(&tick_fe.arguments[0]); } if (!BG(user_tick_functions)) { @@ -6147,7 +6146,7 @@ } if (Z_TYPE_P(function) != IS_ARRAY) { - convert_to_text(function); + convert_to_unicode(function); } tick_fe.arguments = (zval **) emalloc(sizeof(zval *)); @@ -6278,11 +6277,9 @@ 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; @@ -6310,28 +6307,21 @@ 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) { @@ -6345,9 +6335,7 @@ 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); @@ -6376,10 +6364,8 @@ 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; @@ -6472,7 +6458,7 @@ } 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); } @@ -6504,7 +6490,7 @@ } 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"); Index: ext/standard/dir.c =================================================================== RCS file: /repository/php-src/ext/standard/dir.c,v retrieving revision 1.175 diff -u -r1.175 dir.c --- ext/standard/dir.c 5 Mar 2008 12:09:33 -0000 1.175 +++ ext/standard/dir.c 8 Jun 2008 18:17:21 -0000 @@ -422,8 +422,9 @@ long flags = 0; glob_t globbuf; unsigned int n; - int ret; + int ret, path_len; zend_bool basedir_limit = 0; + UChar *path; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|l", &pppattern, &flags) == FAILURE || php_stream_path_param_encode(pppattern, &pattern, &pattern_len, REPORT_ERRORS, FG(default_context)) == FAILURE) { @@ -518,18 +519,12 @@ 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); } } @@ -553,9 +548,10 @@ int dirn_len; long flags = 0; char **namelist; - int n, i; + int n, i, path_len; zval *zcontext = NULL; php_stream_context *context = NULL; + UChar *path; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|lr", &ppdirn, &flags, &zcontext) == FAILURE) { return; @@ -579,18 +575,11 @@ 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); - } + 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); } } Index: ext/standard/file.c =================================================================== RCS file: /repository/php-src/ext/standard/file.c,v retrieving revision 1.519 diff -u -r1.519 file.c --- ext/standard/file.c 28 May 2008 17:24:47 -0000 1.519 +++ ext/standard/file.c 9 Jun 2008 15:51:45 -0000 @@ -619,7 +619,7 @@ 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 }; @@ -935,18 +935,16 @@ } 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); } @@ -2255,7 +2253,7 @@ PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char escape, size_t buf_len, char *buf, zval *return_value TSRMLS_DC) /* {{{ */ { - char *delim = &delimiter, *enc = &enclosure, *buffer = buf, *esc; + char *delim = &delimiter, *enc = &enclosure, *buffer = buf, *esc = NULL; int delim_len = 1, enc_len = 1, esc_len = 1, buffer_len = buf_len; zend_uchar type = IS_STRING; @@ -2746,10 +2744,8 @@ #ifdef ZTS if (VCWD_ACCESS(resolved_path_buff, F_OK)) { RETVAL_FALSE; - } else + } else { #endif - - if (UG(unicode)) { UChar *path; int path_len; @@ -2759,8 +2755,6 @@ /* Fallback */ RETVAL_STRING(resolved_path_buff, 1); } - } else { - RETVAL_STRING(resolved_path_buff, 1); } } else { RETVAL_FALSE; @@ -2923,11 +2917,6 @@ 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; } Index: ext/standard/formatted_print.c =================================================================== RCS file: /repository/php-src/ext/standard/formatted_print.c,v retrieving revision 1.105 diff -u -r1.105 formatted_print.c --- ext/standard/formatted_print.c 17 Mar 2008 23:07:55 -0000 1.105 +++ ext/standard/formatted_print.c 9 Jun 2008 10:58:38 -0000 @@ -1277,18 +1277,13 @@ 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); } /* }}} */ @@ -1299,18 +1294,13 @@ 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); } /* }}} */ @@ -1321,15 +1311,10 @@ 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); @@ -1344,16 +1329,11 @@ { 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); @@ -1382,7 +1362,7 @@ 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) { @@ -1424,7 +1404,7 @@ 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) { Index: ext/standard/head.c =================================================================== RCS file: /repository/php-src/ext/standard/head.c,v retrieving revision 1.99 diff -u -r1.99 head.c --- ext/standard/head.c 28 Feb 2008 14:16:14 -0000 1.99 +++ ext/standard/head.c 8 Jun 2008 19:20:03 -0000 @@ -202,11 +202,13 @@ PHP_FUNCTION(headers_sent) { zval *arg1, *arg2; - char *file=""; - int line=0; + char *file = ""; + int line=0, ufile_len = 0; + UChar *ufile; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|zz", &arg1, &arg2) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|zz", &arg1, &arg2) == FAILURE) { return; + } if (SG(headers_sent)) { line = php_output_get_start_lineno(TSRMLS_C); @@ -219,21 +221,11 @@ ZVAL_LONG(arg2, line); case 1: zval_dtor(arg1); - if (UG(unicode)) { - UChar *ufile; - int ufile_len; - - 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); - } + + 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 { - if (file) { - ZVAL_STRING(arg1, file, 1); - } else { - ZVAL_STRING(arg1, "", 1); - } + ZVAL_EMPTY_UNICODE(arg1); } break; } Index: ext/standard/html.c =================================================================== RCS file: /repository/php-src/ext/standard/html.c,v retrieving revision 1.133 diff -u -r1.133 html.c --- ext/standard/html.c 11 Apr 2008 19:08:04 -0000 1.133 +++ ext/standard/html.c 8 Jun 2008 18:25:11 -0000 @@ -1465,10 +1465,7 @@ return; } - if (UG(unicode)) { - charset = cs_utf_8; - } - + charset = cs_utf_8; array_init(return_value); ind[1] = 0; @@ -1481,21 +1478,15 @@ for (i = 0; i <= entity_map[j].endchar - entity_map[j].basechar; i++) { char buffer[16]; - if (entity_map[j].table[i] == NULL) + 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 */ Index: ext/standard/http_fopen_wrapper.c =================================================================== RCS file: /repository/php-src/ext/standard/http_fopen_wrapper.c,v retrieving revision 1.133 diff -u -r1.133 http_fopen_wrapper.c --- ext/standard/http_fopen_wrapper.c 29 Apr 2008 08:15:49 -0000 1.133 +++ ext/standard/http_fopen_wrapper.c 8 Jun 2008 18:25:47 -0000 @@ -625,7 +625,7 @@ 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: ")); } @@ -781,7 +781,7 @@ } 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); Index: ext/standard/incomplete_class.c =================================================================== RCS file: /repository/php-src/ext/standard/incomplete_class.c,v retrieving revision 1.38 diff -u -r1.38 incomplete_class.c --- ext/standard/incomplete_class.c 31 Dec 2007 07:12:16 -0000 1.38 +++ ext/standard/incomplete_class.c 8 Jun 2008 18:26:39 -0000 @@ -111,7 +111,7 @@ value.handlers = &php_incomplete_object_handlers; ALLOC_HASHTABLE(object->properties); - zend_u_hash_init(object->properties, 0, NULL, ZVAL_PTR_DTOR, 0, UG(unicode)); + zend_u_hash_init(object->properties, 0, NULL, ZVAL_PTR_DTOR, 0, 1); return value; } @@ -146,11 +146,7 @@ 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); Index: ext/standard/link.c =================================================================== RCS file: /repository/php-src/ext/standard/link.c,v retrieving revision 1.61 diff -u -r1.61 link.c --- ext/standard/link.c 31 Dec 2007 07:12:16 -0000 1.61 +++ ext/standard/link.c 8 Jun 2008 18:27:11 -0000 @@ -79,14 +79,10 @@ /* 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; } } /* }}} */ Index: ext/standard/proc_open.c =================================================================== RCS file: /repository/php-src/ext/standard/proc_open.c,v retrieving revision 1.61 diff -u -r1.61 proc_open.c --- ext/standard/proc_open.c 8 Apr 2008 08:42:05 -0000 1.61 +++ ext/standard/proc_open.c 8 Jun 2008 18:29:09 -0000 @@ -319,7 +319,9 @@ #endif int running = 1, signaled = 0, stopped = 0; int exitcode = -1, termsig = 0, stopsig = 0; - + UChar *ucmd; + int ucmd_len; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zproc) == FAILURE) { RETURN_FALSE; } @@ -328,33 +330,24 @@ 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); - + #ifdef PHP_WIN32 - GetExitCodeProcess(proc->childHandle, &wstatus); running = wstatus == STILL_ACTIVE; exitcode == STILL_ACTIVE ? -1 : wstatus; - #elif HAVE_SYS_WAIT_H - errno = 0; wait_pid = waitpid(proc->child, &wstatus, WNOHANG|WUNTRACED); - + if (wait_pid == proc->child) { if (WIFEXITED(wstatus)) { running = 0; @@ -973,7 +966,7 @@ /* 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); @@ -985,7 +978,7 @@ php_stream_encoding_apply(stream, 0, encoding, UG(to_error_mode), NULL); } } - + MAKE_STD_ZVAL(retfp); php_stream_to_zval(stream, retfp); add_index_zval(pipes, descriptors[i].index, retfp); Index: ext/standard/streamsfuncs.c =================================================================== RCS file: /repository/php-src/ext/standard/streamsfuncs.c,v retrieving revision 1.116 diff -u -r1.116 streamsfuncs.c --- ext/standard/streamsfuncs.c 28 May 2008 18:02:52 -0000 1.116 +++ ext/standard/streamsfuncs.c 8 Jun 2008 18:31:18 -0000 @@ -141,8 +141,7 @@ ZVAL_LONG(zerrno, err); } if (zerrstr && errstr) { - /* errstr is emalloc'd, either assign it to STRVAL if !UG(unicode) - * Or free it post-conversion if UG(unicode) */ + /* errstr is emalloc'd, free it post-conversion */ zval_dtor(zerrstr); ZVAL_RT_STRING(zerrstr, errstr, ZSTR_AUTOFREE); } else if (errstr) { @@ -207,8 +206,7 @@ ZVAL_LONG(zerrno, err); } if (zerrstr && errstr) { - /* errstr is emalloc'd, either assign it to STRVAL if !UG(unicode) - * Or free it post-conversion if UG(unicode) */ + /* errstr is emalloc'd, free it post-conversion */ zval_dtor(zerrstr); ZVAL_RT_STRING(zerrstr, errstr, ZSTR_AUTOFREE); } else if (errstr) { @@ -534,17 +532,13 @@ 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"); } } @@ -1612,6 +1606,8 @@ while (ptr < end) { char *s = strchr(ptr, DEFAULT_DIR_SEPARATOR); + UChar *upath; + int upath_len; if (!s) { s = end; @@ -1642,17 +1638,10 @@ 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); } } Index: ext/standard/string.c =================================================================== RCS file: /repository/php-src/ext/standard/string.c,v retrieving revision 1.674 diff -u -r1.674 string.c --- ext/standard/string.c 27 May 2008 10:28:25 -0000 1.674 +++ ext/standard/string.c 9 Jun 2008 11:03:07 -0000 @@ -488,9 +488,7 @@ 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 @@ -1434,25 +1432,21 @@ 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 { @@ -2352,7 +2346,7 @@ 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) { @@ -2638,7 +2632,7 @@ } if (Z_TYPE_PP(haystack) != IS_UNICODE && Z_TYPE_PP(haystack) != IS_STRING) { - convert_to_text_ex(haystack); + convert_to_unicode_ex(haystack); } /* @@ -2750,7 +2744,7 @@ } 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)) { @@ -3044,7 +3038,7 @@ 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) { @@ -3399,11 +3393,11 @@ 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); @@ -3443,7 +3437,7 @@ 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; @@ -3487,7 +3481,7 @@ 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) { @@ -3518,7 +3512,7 @@ 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 { @@ -3637,7 +3631,7 @@ } if (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(str) == IS_UNICODE) { RETURN_LONG(zend_get_codepoint_at(Z_USTRVAL_PP(str), Z_USTRLEN_PP(str), 0)); @@ -3653,28 +3647,22 @@ { zval **num; char temp[2]; + UChar buf[2]; + int buf_len; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) { WRONG_PARAM_COUNT; } - convert_to_long_ex(num); - if (UG(unicode)) { - UChar buf[2]; - int buf_len; - - if (Z_LVAL_PP(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)Z_LVAL_PP(num), buf); - RETURN_UNICODEL(buf, buf_len, 1); - } else { - temp[0] = (char) Z_LVAL_PP(num); - temp[1] = 0; + convert_to_long_ex(num); - RETVAL_STRINGL(temp, 1, 1); + if (Z_LVAL_PP(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)Z_LVAL_PP(num), buf); + RETURN_UNICODEL(buf, buf_len, 1); } /* }}} */ @@ -4319,7 +4307,7 @@ } if (Z_TYPE_PP(str) != IS_UNICODE && Z_TYPE_PP(str) != IS_STRING) { - convert_to_text_ex(str); + convert_to_unicode_ex(str); } /* shortcut for empty string */ @@ -4707,7 +4695,7 @@ if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) { WRONG_PARAM_COUNT; } - convert_to_text_ex(str); + convert_to_unicode_ex(str); if (Z_TYPE_PP(str) == IS_UNICODE && Z_USTRLEN_PP(str) == 0) { RETURN_EMPTY_UNICODE(); @@ -4752,7 +4740,7 @@ if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) { WRONG_PARAM_COUNT; } - convert_to_text_ex(str); + convert_to_unicode_ex(str); if (Z_TYPE_PP(str) == IS_UNICODE) { ZVAL_UNICODEL(return_value, Z_USTRVAL_PP(str), Z_USTRLEN_PP(str), 1); @@ -5547,8 +5535,8 @@ 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; @@ -5575,7 +5563,7 @@ 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) { @@ -5590,7 +5578,7 @@ 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); @@ -5605,42 +5593,28 @@ } 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); } } @@ -5656,42 +5630,28 @@ } } 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; @@ -5721,10 +5681,10 @@ /* 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 */ @@ -6143,9 +6103,7 @@ WRONG_PARAM_COUNT; } - 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 pcategory = args[0]; @@ -7047,7 +7005,7 @@ 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 +7133,7 @@ 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); @@ -7515,7 +7471,7 @@ } if (Z_TYPE_PP(args[0]) != IS_STRING && Z_TYPE_PP(args[0]) != IS_UNICODE) { - convert_to_text_ex(args[0]); + convert_to_unicode_ex(args[0]); } if (Z_TYPE_PP(args[0]) == IS_UNICODE) { Index: ext/standard/type.c =================================================================== RCS file: /repository/php-src/ext/standard/type.c,v retrieving revision 1.55 diff -u -r1.55 type.c --- ext/standard/type.c 29 Mar 2008 22:02:20 -0000 1.55 +++ ext/standard/type.c 8 Jun 2008 18:38:14 -0000 @@ -115,11 +115,7 @@ } 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")) { @@ -202,11 +198,8 @@ WRONG_PARAM_COUNT; } - 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); @@ -237,7 +230,7 @@ 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); @@ -257,12 +250,9 @@ } /* 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) { char *type_name; type_name = zend_rsrc_list_get_rsrc_type(Z_LVAL_P(arg) TSRMLS_CC); @@ -270,6 +260,7 @@ RETURN_FALSE; } } + RETURN_TRUE; } else { RETURN_FALSE; Index: ext/standard/uniqid.c =================================================================== RCS file: /repository/php-src/ext/standard/uniqid.c,v retrieving revision 1.51 diff -u -r1.51 uniqid.c --- ext/standard/uniqid.c 4 May 2008 21:16:22 -0000 1.51 +++ ext/standard/uniqid.c 9 Jun 2008 11:03:25 -0000 @@ -45,7 +45,7 @@ { 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 Index: ext/standard/url.c =================================================================== RCS file: /repository/php-src/ext/standard/url.c,v retrieving revision 1.108 diff -u -r1.108 url.c --- ext/standard/url.c 4 Jun 2008 19:34:45 -0000 1.108 +++ ext/standard/url.c 8 Jun 2008 18:39:38 -0000 @@ -40,11 +40,10 @@ /* * These macros are similar to ZVAL_U_STRING*() but they select between - * Unicode/binary based on explicitly specified type, rather than the - * UG(unicode) global. They may be useful for other functions, but implementing - * them would probably require updating all of the corresponding add_*_assoc_*() - * macros, so let's keep them here for now and revisit the issue if someone else - * needs them in the future. + * Unicode/binary based on explicitly specified type. They may be useful for + * other functions, but implementing them would probably require updating all + * of the corresponding add_*_assoc_*() macros, so let's keep them here for + * now and revisit the issue if someone else needs them in the future. */ #define ZVAL_UT_STRING(conv, type, z, s, flags) { \ if (type == IS_UNICODE) { \ Index: ext/standard/var.c =================================================================== RCS file: /repository/php-src/ext/standard/var.c,v retrieving revision 1.274 diff -u -r1.274 var.c --- ext/standard/var.c 31 Dec 2007 07:12:16 -0000 1.274 +++ ext/standard/var.c 8 Jun 2008 18:41:08 -0000 @@ -793,11 +793,7 @@ 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; @@ -851,7 +847,7 @@ } 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 */ @@ -997,11 +993,7 @@ 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); @@ -1159,9 +1151,7 @@ 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(); } Index: ext/standard/var_unserializer.c =================================================================== RCS file: /repository/php-src/ext/standard/var_unserializer.c,v retrieving revision 1.95 diff -u -r1.95 var_unserializer.c --- ext/standard/var_unserializer.c 27 May 2008 11:27:58 -0000 1.95 +++ ext/standard/var_unserializer.c 9 Jun 2008 13:47:46 -0000 @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Tue May 27 06:15:01 2008 */ +/* Generated by re2c 0.13.5 on Mon Jun 09 14:47:24 2008 */ #line 1 "ext/standard/var_unserializer.re" /* +----------------------------------------------------------------------+ @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: var_unserializer.c,v 1.95 2008/05/27 11:27:58 mattwil Exp $ */ +/* $Id: var_unserializer.re,v 1.74 2008/05/27 10:28:25 mattwil Exp $ */ #include "php.h" #include "ext/standard/php_var.h" @@ -524,7 +524,7 @@ yych = *(YYMARKER = ++YYCURSOR); if (yych == ':') goto yy103; yy3: -#line 791 "ext/standard/var_unserializer.re" +#line 782 "ext/standard/var_unserializer.re" { return 0; } #line 530 "ext/standard/var_unserializer.c" yy4: @@ -573,7 +573,7 @@ goto yy3; yy15: ++YYCURSOR; -#line 785 "ext/standard/var_unserializer.re" +#line 776 "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"); @@ -611,7 +611,7 @@ ++YYCURSOR; #line 672 "ext/standard/var_unserializer.re" { - size_t len, len2, len3, maxlen; + size_t len, len2, maxlen; long elements; zstr class_name; zend_class_entry *ce; @@ -632,22 +632,13 @@ INIT_PZVAL(*rval); len2 = len = parse_uiv(start + 2); maxlen = max - YYCURSOR; + if (maxlen < len || len == 0) { *p = start + 2; 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); @@ -662,7 +653,7 @@ 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; } @@ -693,7 +684,7 @@ } /* 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); @@ -722,7 +713,7 @@ return object_common2(UNSERIALIZE_PASSTHRU, elements); } -#line 726 "ext/standard/var_unserializer.c" +#line 717 "ext/standard/var_unserializer.c" yy26: yych = *++YYCURSOR; if (yych <= ',') { @@ -755,7 +746,7 @@ return object_common2(UNSERIALIZE_PASSTHRU, object_common1(UNSERIALIZE_PASSTHRU, ZEND_STANDARD_CLASS_DEF_PTR)); } -#line 759 "ext/standard/var_unserializer.c" +#line 750 "ext/standard/var_unserializer.c" yy33: yych = *++YYCURSOR; if (yych == '+') goto yy34; @@ -796,7 +787,7 @@ return finish_nested_data(UNSERIALIZE_PASSTHRU); } -#line 800 "ext/standard/var_unserializer.c" +#line 791 "ext/standard/var_unserializer.c" yy40: yych = *++YYCURSOR; if (yych == '+') goto yy41; @@ -846,7 +837,7 @@ ZVAL_UNICODEL(*rval, ustr, len, 0); return 1; } -#line 850 "ext/standard/var_unserializer.c" +#line 841 "ext/standard/var_unserializer.c" yy47: yych = *++YYCURSOR; if (yych == '+') goto yy48; @@ -896,7 +887,7 @@ ZVAL_STRINGL(*rval, str, len, 0); return 1; } -#line 900 "ext/standard/var_unserializer.c" +#line 891 "ext/standard/var_unserializer.c" yy54: yych = *++YYCURSOR; if (yych == '+') goto yy55; @@ -945,7 +936,7 @@ ZVAL_STRINGL(*rval, str, len, 1); return 1; } -#line 949 "ext/standard/var_unserializer.c" +#line 940 "ext/standard/var_unserializer.c" yy61: yych = *++YYCURSOR; if (yych <= '/') { @@ -1040,7 +1031,7 @@ ZVAL_DOUBLE(*rval, zend_strtod((const char *)start + 2, NULL)); return 1; } -#line 1044 "ext/standard/var_unserializer.c" +#line 1035 "ext/standard/var_unserializer.c" yy73: yych = *++YYCURSOR; if (yych <= ',') { @@ -1114,7 +1105,7 @@ return 1; } -#line 1118 "ext/standard/var_unserializer.c" +#line 1109 "ext/standard/var_unserializer.c" yy84: yych = *++YYCURSOR; if (yych == 'N') goto yy81; @@ -1148,7 +1139,7 @@ ZVAL_LONG(*rval, parse_iv(start + 2)); return 1; } -#line 1152 "ext/standard/var_unserializer.c" +#line 1143 "ext/standard/var_unserializer.c" yy91: yych = *++YYCURSOR; if (yych <= '/') goto yy19; @@ -1163,7 +1154,7 @@ ZVAL_BOOL(*rval, parse_iv(start + 2)); return 1; } -#line 1167 "ext/standard/var_unserializer.c" +#line 1158 "ext/standard/var_unserializer.c" yy95: ++YYCURSOR; #line 515 "ext/standard/var_unserializer.re" @@ -1173,7 +1164,7 @@ ZVAL_NULL(*rval); return 1; } -#line 1177 "ext/standard/var_unserializer.c" +#line 1168 "ext/standard/var_unserializer.c" yy97: yych = *++YYCURSOR; if (yych <= ',') { @@ -1219,7 +1210,7 @@ return 1; } -#line 1223 "ext/standard/var_unserializer.c" +#line 1214 "ext/standard/var_unserializer.c" yy103: yych = *++YYCURSOR; if (yych <= ',') { @@ -1263,9 +1254,9 @@ return 1; } -#line 1267 "ext/standard/var_unserializer.c" +#line 1258 "ext/standard/var_unserializer.c" } -#line 793 "ext/standard/var_unserializer.re" +#line 784 "ext/standard/var_unserializer.re" return 0; Index: ext/standard/var_unserializer.re =================================================================== RCS file: /repository/php-src/ext/standard/var_unserializer.re,v retrieving revision 1.74 diff -u -r1.74 var_unserializer.re --- ext/standard/var_unserializer.re 27 May 2008 10:28:25 -0000 1.74 +++ ext/standard/var_unserializer.re 9 Jun 2008 13:47:03 -0000 @@ -670,7 +670,7 @@ } object ":" uiv ":" ["] { - size_t len, len2, len3, maxlen; + size_t len, len2, maxlen; long elements; zstr class_name; zend_class_entry *ce; @@ -691,22 +691,13 @@ INIT_PZVAL(*rval); len2 = len = parse_uiv(start + 2); maxlen = max - YYCURSOR; + if (maxlen < len || len == 0) { *p = start + 2; 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); @@ -721,7 +712,7 @@ 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; } @@ -752,7 +743,7 @@ } /* 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);