dmitry Tue Aug 23 08:53:32 2005 EDT Modified files: /php-src unicode-progress.txt /ZendEngine2 zend_API.c zend_API.h zend_builtin_functions.c zend_exceptions.c /php-src/ext/standard dir.c dns.c filestat.c info.c link.c string.c type.c uniqid.c /php-src/ext/standard/tests/file userdirstream.phpt /php-src/ext/standard/tests/strings bug24098.phpt /php-src/tests/reflection parameters_001.phpt Log: Unicode support
http://cvs.php.net/diff.php/php-src/unicode-progress.txt?r1=1.5&r2=1.6&ty=u Index: php-src/unicode-progress.txt diff -u php-src/unicode-progress.txt:1.5 php-src/unicode-progress.txt:1.6 --- php-src/unicode-progress.txt:1.5 Tue Aug 23 02:51:11 2005 +++ php-src/unicode-progress.txt Tue Aug 23 08:53:15 2005 @@ -22,9 +22,6 @@ -- Status: In Progress debug_backtrace() - extension_loaded() - get_extension_funcs() - get_included_files() Completed: class_exists() create_function() @@ -33,6 +30,7 @@ defined() each() error_reporting() + extension_loaded() func_get_arg() func_get_args() func_num_args() @@ -45,6 +43,8 @@ get_defined_constants() get_defined_functions() get_defined_vars() + get_extension_funcs() + get_included_files() get_loaded_extensions() get_object_vars() get_parent_class() http://cvs.php.net/diff.php/ZendEngine2/zend_API.c?r1=1.312&r2=1.313&ty=u Index: ZendEngine2/zend_API.c diff -u ZendEngine2/zend_API.c:1.312 ZendEngine2/zend_API.c:1.313 --- ZendEngine2/zend_API.c:1.312 Mon Aug 22 13:48:17 2005 +++ ZendEngine2/zend_API.c Tue Aug 23 08:53:19 2005 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.c,v 1.312 2005/08/22 17:48:17 andrei Exp $ */ +/* $Id: zend_API.c,v 1.313 2005/08/23 12:53:19 dmitry Exp $ */ #include "zend.h" #include "zend_execute.h" @@ -1711,6 +1711,66 @@ return SUCCESS; } +ZEND_API int add_property_ascii_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate TSRMLS_DC) +{ + zval *tmp; + zval z_key; + + MAKE_STD_ZVAL(tmp); + ZVAL_ASCII_STRING(tmp, str, duplicate); + + ZVAL_STRINGL(&z_key, key, key_len-1, 0); + + Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, tmp TSRMLS_CC); + zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ + return SUCCESS; +} + +ZEND_API int add_property_ascii_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate TSRMLS_DC) +{ + zval *tmp; + zval z_key; + + MAKE_STD_ZVAL(tmp); + ZVAL_ASCII_STRINGL(tmp, str, length, duplicate); + + ZVAL_STRINGL(&z_key, key, key_len-1, 0); + + Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, tmp TSRMLS_CC); + zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ + return SUCCESS; +} + +ZEND_API int add_property_rt_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate TSRMLS_DC) +{ + zval *tmp; + zval z_key; + + MAKE_STD_ZVAL(tmp); + ZVAL_RT_STRING(tmp, str, duplicate); + + ZVAL_STRINGL(&z_key, key, key_len-1, 0); + + Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, tmp TSRMLS_CC); + zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ + return SUCCESS; +} + +ZEND_API int add_property_rt_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate TSRMLS_DC) +{ + zval *tmp; + zval z_key; + + MAKE_STD_ZVAL(tmp); + ZVAL_RT_STRINGL(tmp, str, length, duplicate); + + ZVAL_STRINGL(&z_key, key, key_len-1, 0); + + Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, tmp TSRMLS_CC); + zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ + return SUCCESS; +} + ZEND_API int add_property_zval_ex(zval *arg, char *key, uint key_len, zval *value TSRMLS_DC) { zval z_key; @@ -2937,6 +2997,50 @@ zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC); } +ZEND_API void zend_update_property_ascii_string(zend_class_entry *scope, zval *object, char *name, int name_length, char *value TSRMLS_DC) +{ + zval *tmp; + + ALLOC_ZVAL(tmp); + tmp->is_ref = 0; + tmp->refcount = 0; + ZVAL_ASCII_STRING(tmp, value, 1); + zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC); +} + +ZEND_API void zend_update_property_ascii_stringl(zend_class_entry *scope, zval *object, char *name, int name_length, char *value, int value_len TSRMLS_DC) +{ + zval *tmp; + + ALLOC_ZVAL(tmp); + tmp->is_ref = 0; + tmp->refcount = 0; + ZVAL_ASCII_STRINGL(tmp, value, value_len, 1); + zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC); +} + +ZEND_API void zend_update_property_rt_string(zend_class_entry *scope, zval *object, char *name, int name_length, char *value TSRMLS_DC) +{ + zval *tmp; + + ALLOC_ZVAL(tmp); + tmp->is_ref = 0; + tmp->refcount = 0; + ZVAL_RT_STRING(tmp, value, 1); + zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC); +} + +ZEND_API void zend_update_property_rt_stringl(zend_class_entry *scope, zval *object, char *name, int name_length, char *value, int value_len TSRMLS_DC) +{ + zval *tmp; + + ALLOC_ZVAL(tmp); + tmp->is_ref = 0; + tmp->refcount = 0; + ZVAL_RT_STRINGL(tmp, value, value_len, 1); + zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC); +} + ZEND_API void zend_update_property_unicode(zend_class_entry *scope, zval *object, char *name, int name_length, UChar *value TSRMLS_DC) { zval *tmp; http://cvs.php.net/diff.php/ZendEngine2/zend_API.h?r1=1.218&r2=1.219&ty=u Index: ZendEngine2/zend_API.h diff -u ZendEngine2/zend_API.h:1.218 ZendEngine2/zend_API.h:1.219 --- ZendEngine2/zend_API.h:1.218 Tue Aug 23 05:33:43 2005 +++ ZendEngine2/zend_API.h Tue Aug 23 08:53:19 2005 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.h,v 1.218 2005/08/23 09:33:43 dmitry Exp $ */ +/* $Id: zend_API.h,v 1.219 2005/08/23 12:53:19 dmitry Exp $ */ #ifndef ZEND_API_H #define ZEND_API_H @@ -228,6 +228,10 @@ ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, char *name, int name_length, double value TSRMLS_DC); ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, char *name, int name_length, char *value TSRMLS_DC); ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, char *name, int name_length, char *value, int value_length TSRMLS_DC); +ZEND_API void zend_update_property_ascii_string(zend_class_entry *scope, zval *object, char *name, int name_length, char *value TSRMLS_DC); +ZEND_API void zend_update_property_ascii_stringl(zend_class_entry *scope, zval *object, char *name, int name_length, char *value, int value_length TSRMLS_DC); +ZEND_API void zend_update_property_rt_string(zend_class_entry *scope, zval *object, char *name, int name_length, char *value TSRMLS_DC); +ZEND_API void zend_update_property_rt_stringl(zend_class_entry *scope, zval *object, char *name, int name_length, char *value, int value_length TSRMLS_DC); ZEND_API void zend_update_property_unicode(zend_class_entry *scope, zval *object, char *name, int name_length, UChar *value TSRMLS_DC); 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); @@ -306,6 +310,29 @@ add_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, duplicate); \ } +#define add_assoc_rt_string_ex(arg, key, key_len, str, duplicate) \ + if (UG(unicode)) { \ + UErrorCode status = U_ZERO_ERROR; \ + UChar *u_str; \ + int32_t u_len; \ + int length = strlen(str); \ + zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, str, length, &status); \ + add_assoc_unicodel_ex(arg, key, key_len, u_str, u_len, 0); \ + } else { \ + add_assoc_string_ex(arg, key, key_len, (char*)(str), duplicate); \ + } + +#define add_assoc_rt_stringl_ex(arg, key, key_len, str, length, duplicate) \ + if (UG(unicode)) { \ + UErrorCode status = U_ZERO_ERROR; \ + UChar *u_str; \ + int32_t u_len; \ + zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, str, length, &status); \ + add_assoc_unicodel_ex(arg, key, key_len, u_str, u_len, 0); \ + } else { \ + add_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, duplicate); \ + } + #define add_assoc_long(__arg, __key, __n) add_assoc_long_ex(__arg, __key, strlen(__key)+1, __n) #define add_assoc_null(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key) + 1) #define add_assoc_bool(__arg, __key, __b) add_assoc_bool_ex(__arg, __key, strlen(__key)+1, __b) @@ -316,6 +343,8 @@ #define add_assoc_unicode(__arg, __key, __str, __duplicate) add_assoc_unicode_ex(__arg, __key, strlen(__key)+1, __str, __duplicate) #define add_assoc_unicodel(__arg, __key, __str, __length, __duplicate) add_assoc_unicodel_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate) #define add_assoc_zval(__arg, __key, __value) add_assoc_zval_ex(__arg, __key, strlen(__key)+1, __value) +#define add_assoc_rt_string(__arg, __key, __str, __duplicate) add_assoc_rt_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate) +#define add_assoc_rt_stringl(__arg, __key, __str, __length, __duplicate) add_assoc_rt_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate) #define add_assoc_text(arg, key, str, duplicate) \ if (UG(unicode)) { \ @@ -446,6 +475,29 @@ add_next_index_stringl(arg, (char*)(str), length, duplicate); \ } +#define add_next_index_rt_string(arg, str, duplicate) \ + if (UG(unicode)) { \ + UErrorCode status = U_ZERO_ERROR; \ + UChar *u_str; \ + int32_t u_len; \ + int length = strlen(str); \ + zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, str, length, &status); \ + add_next_index_unicodel(arg, u_str, u_len, 0); \ + } else { \ + add_next_index_string(arg, (char*)(str), duplicate); \ + } + +#define add_next_index_rt_stringl(arg, str, length, duplicate) \ + if (UG(unicode)) { \ + UErrorCode status = U_ZERO_ERROR; \ + UChar *u_str; \ + int32_t u_len; \ + zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, str, length, &status); \ + add_next_index_unicodel(arg, u_str, u_len, 0); \ + } else { \ + add_next_index_stringl(arg, (char*)(str), length, duplicate); \ + } + ZEND_API int add_get_assoc_string_ex(zval *arg, char *key, uint key_len, char *str, void **dest, int duplicate); ZEND_API int add_get_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, void **dest, int duplicate); @@ -469,6 +521,10 @@ ZEND_API int add_property_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate TSRMLS_DC); ZEND_API int add_property_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate TSRMLS_DC); ZEND_API int add_property_zval_ex(zval *arg, char *key, uint key_len, zval *value TSRMLS_DC); +ZEND_API int add_property_ascii_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate TSRMLS_DC); +ZEND_API int add_property_ascii_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate TSRMLS_DC); +ZEND_API int add_property_rt_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate TSRMLS_DC); +ZEND_API int add_property_rt_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate TSRMLS_DC); #define add_property_long(__arg, __key, __n) add_property_long_ex(__arg, __key, strlen(__key)+1, __n TSRMLS_CC) #define add_property_null(__arg, __key) add_property_null_ex(__arg, __key, strlen(__key) + 1 TSRMLS_CC) @@ -477,6 +533,10 @@ #define add_property_double(__arg, __key, __d) add_property_double_ex(__arg, __key, strlen(__key)+1, __d TSRMLS_CC) #define add_property_string(__arg, __key, __str, __duplicate) add_property_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate TSRMLS_CC) #define add_property_stringl(__arg, __key, __str, __length, __duplicate) add_property_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate TSRMLS_CC) +#define add_property_ascii_string(__arg, __key, __str, __duplicate) add_property_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate TSRMLS_CC) +#define add_property_ascii_stringl(__arg, __key, __str, __length, __duplicate) add_property_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate TSRMLS_CC) +#define add_property_rt_string(__arg, __key, __str, __duplicate) add_property_ascii_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate TSRMLS_CC) +#define add_property_rt_stringl(__arg, __key, __str, __length, __duplicate) add_property_rt_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate TSRMLS_CC) #define add_property_zval(__arg, __key, __value) add_property_zval_ex(__arg, __key, strlen(__key)+1, __value TSRMLS_CC) http://cvs.php.net/diff.php/ZendEngine2/zend_builtin_functions.c?r1=1.289&r2=1.290&ty=u Index: ZendEngine2/zend_builtin_functions.c diff -u ZendEngine2/zend_builtin_functions.c:1.289 ZendEngine2/zend_builtin_functions.c:1.290 --- ZendEngine2/zend_builtin_functions.c:1.289 Tue Aug 23 03:23:29 2005 +++ ZendEngine2/zend_builtin_functions.c Tue Aug 23 08:53:20 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_builtin_functions.c,v 1.289 2005/08/23 07:23:29 dmitry Exp $ */ +/* $Id: zend_builtin_functions.c,v 1.290 2005/08/23 12:53:20 dmitry Exp $ */ #include "zend.h" #include "zend_API.h" @@ -1158,8 +1158,8 @@ array_init(return_value); zend_hash_internal_pointer_reset(&EG(included_files)); - while (zend_hash_get_current_key(&EG(included_files), &entry, NULL, 1) == HASH_KEY_IS_STRING) { - add_next_index_string(return_value, entry, 0); + while (zend_hash_get_current_key(&EG(included_files), &entry, NULL, 0) == HASH_KEY_IS_STRING) { + add_next_index_rt_string(return_value, entry, 1); zend_hash_move_forward(&EG(included_files)); } } @@ -1979,7 +1979,7 @@ if (skip->op_array) { filename = skip->op_array->filename; lineno = skip->opline->lineno; - add_assoc_string_ex(stack_frame, "file", sizeof("file"), filename, 1); + add_assoc_rt_string_ex(stack_frame, "file", sizeof("file"), filename, 1); add_assoc_long_ex(stack_frame, "line", sizeof("line"), lineno); /* try to fetch args only if an FCALL was just made - elsewise we're in the middle of a function @@ -2060,7 +2060,7 @@ if we have called include in the frame above - this is the file we have included. */ - add_next_index_string(arg_array, include_filename, 1); + add_next_index_rt_string(arg_array, include_filename, 1); add_assoc_zval_ex(stack_frame, "args", sizeof("args"), arg_array); } http://cvs.php.net/diff.php/ZendEngine2/zend_exceptions.c?r1=1.88&r2=1.89&ty=u Index: ZendEngine2/zend_exceptions.c diff -u ZendEngine2/zend_exceptions.c:1.88 ZendEngine2/zend_exceptions.c:1.89 --- ZendEngine2/zend_exceptions.c:1.88 Fri Aug 19 09:20:14 2005 +++ ZendEngine2/zend_exceptions.c Tue Aug 23 08:53:21 2005 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_exceptions.c,v 1.88 2005/08/19 13:20:14 dmitry Exp $ */ +/* $Id: zend_exceptions.c,v 1.89 2005/08/23 12:53:21 dmitry Exp $ */ #include "zend.h" #include "zend_API.h" @@ -94,7 +94,7 @@ trace->refcount = 0; zend_fetch_debug_backtrace(trace, skip_top_traces TSRMLS_CC); - zend_update_property_string(U_CLASS_ENTRY(default_exception_ce), &obj, "file", sizeof("file")-1, zend_get_executed_filename(TSRMLS_C) TSRMLS_CC); + zend_update_property_rt_string(U_CLASS_ENTRY(default_exception_ce), &obj, "file", sizeof("file")-1, zend_get_executed_filename(TSRMLS_C) TSRMLS_CC); zend_update_property_long(U_CLASS_ENTRY(default_exception_ce), &obj, "line", sizeof("line")-1, zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC); zend_update_property(U_CLASS_ENTRY(default_exception_ce), &obj, "trace", sizeof("trace")-1, trace TSRMLS_CC); @@ -141,6 +141,14 @@ if (message) { if (message_type == IS_UNICODE) { zend_update_property_unicodel(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, message, message_len TSRMLS_CC); + } else if (UG(unicode)) { + UErrorCode status = U_ZERO_ERROR; + UChar *u_str; + int32_t u_len; + + zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, message, message_len, &status); + zend_update_property_unicodel(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, u_str, u_len TSRMLS_CC); + efree(u_str); } else { zend_update_property_stringl(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, message, message_len TSRMLS_CC); } @@ -172,6 +180,14 @@ if (message) { if (message_type == IS_UNICODE) { zend_update_property_unicodel(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, message, message_len TSRMLS_CC); + } else if (UG(unicode)) { + UErrorCode status = U_ZERO_ERROR; + UChar *u_str; + int32_t u_len; + + zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, message, message_len, &status); + zend_update_property_unicodel(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, u_str, u_len TSRMLS_CC); + efree(u_str); } else { zend_update_property_stringl(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, message, message_len TSRMLS_CC); } @@ -286,12 +302,23 @@ #define TRACE_APPEND_STRL(val, vallen) \ { \ - int l = vallen; \ + int l = vallen; \ *str = (char*)erealloc(*str, *len + l + 1); \ memcpy((*str) + *len, val, l); \ *len += l; \ } +#define TRACE_APPEND_ZVAL(zv) \ + if (Z_TYPE_P((zv)) == IS_UNICODE) { \ + zval copy; \ + int use_copy; \ + zend_make_printable_zval((zv), ©, &use_copy); \ + TRACE_APPEND_STRL(Z_STRVAL(copy), Z_STRLEN(copy)); \ + zval_dtor(©); \ + } else { \ + TRACE_APPEND_STRL(Z_STRVAL_P((zv)), Z_STRLEN_P((zv))); \ + } + #define TRACE_APPEND_STR(val) \ TRACE_APPEND_STRL(val, sizeof(val)-1) @@ -436,8 +463,9 @@ } else { line = 0; } - s_tmp = emalloc(Z_STRLEN_PP(file) + MAX_LENGTH_OF_LONG + 2 + 1); - sprintf(s_tmp, "%s(%ld): ", Z_STRVAL_PP(file), line); + TRACE_APPEND_ZVAL(*file); + s_tmp = emalloc(MAX_LENGTH_OF_LONG + 2 + 1); + sprintf(s_tmp, "(%ld): ", line); TRACE_APPEND_STRL(s_tmp, strlen(s_tmp)); efree(s_tmp); } else { @@ -646,7 +674,7 @@ if (message) { - zend_update_property_string(U_CLASS_ENTRY(default_exception_ce), ex, "message", sizeof("message")-1, message TSRMLS_CC); + zend_update_property_rt_string(U_CLASS_ENTRY(default_exception_ce), ex, "message", sizeof("message")-1, message TSRMLS_CC); } if (code) { zend_update_property_long(U_CLASS_ENTRY(default_exception_ce), ex, "code", sizeof("code")-1, code TSRMLS_CC); @@ -723,7 +751,15 @@ file = zend_read_property(U_CLASS_ENTRY(default_exception_ce), exception, "file", sizeof("file")-1, 1 TSRMLS_CC); line = zend_read_property(U_CLASS_ENTRY(default_exception_ce), exception, "line", sizeof("line")-1, 1 TSRMLS_CC); - zend_error_va(E_ERROR, Z_STRVAL_P(file), Z_LVAL_P(line), "Uncaught %R\n thrown", Z_TYPE_P(str), Z_UNIVAL_P(str)); + if (Z_TYPE_P(file) == IS_UNICODE) { + zval copy; + int use_copy; + zend_make_printable_zval(file, ©, &use_copy); + zend_error_va(E_ERROR, Z_STRVAL(copy), Z_LVAL_P(line), "Uncaught %R\n thrown", Z_TYPE_P(str), Z_UNIVAL_P(str)); + zval_dtor(©); + } else { + zend_error_va(E_ERROR, Z_STRVAL_P(file), Z_LVAL_P(line), "Uncaught %R\n thrown", Z_TYPE_P(str), Z_UNIVAL_P(str)); + } } else { zend_error(E_ERROR, "Uncaught exception '%v'", ce_exception->name); } http://cvs.php.net/diff.php/php-src/ext/standard/dir.c?r1=1.147&r2=1.148&ty=u Index: php-src/ext/standard/dir.c diff -u php-src/ext/standard/dir.c:1.147 php-src/ext/standard/dir.c:1.148 --- php-src/ext/standard/dir.c:1.147 Wed Aug 3 10:07:58 2005 +++ php-src/ext/standard/dir.c Tue Aug 23 08:53:22 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dir.c,v 1.147 2005/08/03 14:07:58 sniper Exp $ */ +/* $Id: dir.c,v 1.148 2005/08/23 12:53:22 dmitry Exp $ */ /* {{{ includes/startup/misc */ @@ -201,8 +201,8 @@ php_set_default_dir(dirp->rsrc_id TSRMLS_CC); if (createobject) { - object_init_ex(return_value, dir_class_entry_ptr); - add_property_stringl(return_value, "path", dirname, dir_len, 1); + object_init_ex(return_value, U_CLASS_ENTRY(dir_class_entry_ptr)); + add_property_rt_stringl(return_value, "path", dirname, dir_len, 1); add_property_resource(return_value, "handle", dirp->rsrc_id); php_stream_auto_cleanup(dirp); /* so we don't get warnings under debug */ } else { @@ -318,7 +318,7 @@ #endif if (ret) { - RETURN_STRING(path, 1); + RETURN_RT_STRING(path, 1); } else { RETURN_FALSE; } @@ -349,7 +349,7 @@ FETCH_DIRP(); if (php_stream_readdir(dirp, &entry)) { - RETURN_STRINGL(entry.d_name, strlen(entry.d_name), 1); + RETURN_RT_STRINGL(entry.d_name, strlen(entry.d_name), 1); } RETURN_FALSE; } @@ -450,7 +450,7 @@ continue; } } - add_next_index_string(return_value, globbuf.gl_pathv[n]+cwd_skip, 1); + add_next_index_rt_string(return_value, globbuf.gl_pathv[n]+cwd_skip, 1); } globfree(&globbuf); @@ -491,7 +491,10 @@ array_init(return_value); for (i = 0; i < n; i++) { - add_next_index_string(return_value, namelist[i], 0); + add_next_index_rt_string(return_value, namelist[i], 0); + if (UG(unicode)) { + efree(namelist[i]); + } } if (n) { http://cvs.php.net/diff.php/php-src/ext/standard/dns.c?r1=1.70&r2=1.71&ty=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.70 php-src/ext/standard/dns.c:1.71 --- php-src/ext/standard/dns.c:1.70 Wed Aug 3 10:07:58 2005 +++ php-src/ext/standard/dns.c Tue Aug 23 08:53:22 2005 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dns.c,v 1.70 2005/08/03 14:07:58 sniper Exp $ */ +/* $Id: dns.c,v 1.71 2005/08/23 12:53:22 dmitry Exp $ */ /* {{{ includes */ #include "php.h" @@ -142,7 +142,10 @@ #endif RETVAL_FALSE; } else { - RETVAL_STRING(addr, 0); + RETVAL_RT_STRING(addr, 0); + if (UG(unicode)) { + efree(addr); + } } } /* }}} */ @@ -187,6 +190,7 @@ PHP_FUNCTION(gethostbyname) { zval **arg; + char *tmp; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) { ZEND_WRONG_PARAM_COUNT(); @@ -194,7 +198,11 @@ convert_to_string_ex(arg); - RETVAL_STRING(php_gethostbyname(Z_STRVAL_PP(arg)), 0); + tmp = php_gethostbyname(Z_STRVAL_PP(arg)); + RETVAL_RT_STRING(tmp, 0); + if (UG(unicode)) { + efree(tmp); + } } /* }}} */ @@ -221,7 +229,7 @@ for (i = 0 ; hp->h_addr_list[i] != 0 ; i++) { in = *(struct in_addr *) hp->h_addr_list[i]; - add_next_index_string(return_value, inet_ntoa(in), 1); + add_next_index_rt_string(return_value, inet_ntoa(in), 1); } } /* }}} */ http://cvs.php.net/diff.php/php-src/ext/standard/filestat.c?r1=1.136&r2=1.137&ty=u Index: php-src/ext/standard/filestat.c diff -u php-src/ext/standard/filestat.c:1.136 php-src/ext/standard/filestat.c:1.137 --- php-src/ext/standard/filestat.c:1.136 Wed Aug 3 10:07:59 2005 +++ php-src/ext/standard/filestat.c Tue Aug 23 08:53:23 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: filestat.c,v 1.136 2005/08/03 14:07:59 sniper Exp $ */ +/* $Id: filestat.c,v 1.137 2005/08/23 12:53:23 dmitry Exp $ */ #include "php.h" #include "safe_mode.h" @@ -658,20 +658,20 @@ #endif case FS_TYPE: if (S_ISLNK(ssb.sb.st_mode)) { - RETURN_STRING("link", 1); + RETURN_ASCII_STRING("link", 1); } switch(ssb.sb.st_mode & S_IFMT) { - case S_IFIFO: RETURN_STRING("fifo", 1); - case S_IFCHR: RETURN_STRING("char", 1); - case S_IFDIR: RETURN_STRING("dir", 1); - case S_IFBLK: RETURN_STRING("block", 1); - case S_IFREG: RETURN_STRING("file", 1); + case S_IFIFO: RETURN_ASCII_STRING("fifo", 1); + case S_IFCHR: RETURN_ASCII_STRING("char", 1); + case S_IFDIR: RETURN_ASCII_STRING("dir", 1); + case S_IFBLK: RETURN_ASCII_STRING("block", 1); + case S_IFREG: RETURN_ASCII_STRING("file", 1); #if defined(S_IFSOCK) && !defined(ZEND_WIN32)&&!defined(__BEOS__) - case S_IFSOCK: RETURN_STRING("socket", 1); + case S_IFSOCK: RETURN_ASCII_STRING("socket", 1); #endif } php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unknown file type (%d)", ssb.sb.st_mode&S_IFMT); - RETURN_STRING("unknown", 1); + RETURN_ASCII_STRING("unknown", 1); case FS_IS_W: RETURN_BOOL((ssb.sb.st_mode & wmask) != 0); case FS_IS_R: http://cvs.php.net/diff.php/php-src/ext/standard/info.c?r1=1.253&r2=1.254&ty=u Index: php-src/ext/standard/info.c diff -u php-src/ext/standard/info.c:1.253 php-src/ext/standard/info.c:1.254 --- php-src/ext/standard/info.c:1.253 Mon Aug 15 20:25:21 2005 +++ php-src/ext/standard/info.c Tue Aug 23 08:53:24 2005 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: info.c,v 1.253 2005/08/16 00:25:21 iliaa Exp $ */ +/* $Id: info.c,v 1.254 2005/08/23 12:53:24 dmitry Exp $ */ #include "php.h" #include "php_ini.h" @@ -1011,7 +1011,7 @@ int argc = ZEND_NUM_ARGS(); if (argc == 0) { - RETURN_STRING(PHP_VERSION, 1); + RETURN_ASCII_STRING(PHP_VERSION, 1); } else if (argc == 1 && zend_get_parameters_ex(1, &arg) == SUCCESS) { char *version; convert_to_string_ex(arg); @@ -1019,7 +1019,7 @@ if (version == NULL) { RETURN_FALSE; } - RETURN_STRING(version, 1); + RETURN_ASCII_STRING(version, 1); } else { WRONG_PARAM_COUNT; } @@ -1079,7 +1079,7 @@ WRONG_PARAM_COUNT; } - RETURN_STRING(php_logo_guid(), 0); + RETURN_ASCII_STRING(php_logo_guid(), 0); } /* }}} */ @@ -1092,7 +1092,7 @@ WRONG_PARAM_COUNT; } - RETURN_STRINGL(PHP_LOGO_GUID, sizeof(PHP_LOGO_GUID)-1, 1); + RETURN_ASCII_STRINGL(PHP_LOGO_GUID, sizeof(PHP_LOGO_GUID)-1, 1); } /* }}} */ @@ -1104,7 +1104,7 @@ WRONG_PARAM_COUNT; } - RETURN_STRINGL(PHP_EGG_LOGO_GUID, sizeof(PHP_EGG_LOGO_GUID)-1, 1); + RETURN_ASCII_STRINGL(PHP_EGG_LOGO_GUID, sizeof(PHP_EGG_LOGO_GUID)-1, 1); } /* }}} */ @@ -1116,7 +1116,7 @@ WRONG_PARAM_COUNT; } - RETURN_STRINGL(ZEND_LOGO_GUID, sizeof(ZEND_LOGO_GUID)-1, 1); + RETURN_ASCII_STRINGL(ZEND_LOGO_GUID, sizeof(ZEND_LOGO_GUID)-1, 1); } /* }}} */ @@ -1129,7 +1129,7 @@ } if (sapi_module.name) { - RETURN_STRING(sapi_module.name, 1); + RETURN_ASCII_STRING(sapi_module.name, 1); } else { RETURN_FALSE; } @@ -1143,10 +1143,16 @@ { char *mode = "a"; int modelen; + char *tmp; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &mode, &modelen) == FAILURE) { return; } - RETURN_STRING(php_get_uname(*mode), 0); + tmp = php_get_uname(*mode); + RETVAL_RT_STRING(tmp, 0); + if (UG(unicode)) { + efree(tmp); + } } /* }}} */ @@ -1156,7 +1162,7 @@ PHP_FUNCTION(php_ini_scanned_files) { if (strlen(PHP_CONFIG_FILE_SCAN_DIR) && php_ini_scanned_files) { - RETURN_STRING(php_ini_scanned_files, 1); + RETURN_RT_STRING(php_ini_scanned_files, 1); } else { RETURN_FALSE; } http://cvs.php.net/diff.php/php-src/ext/standard/link.c?r1=1.52&r2=1.53&ty=u Index: php-src/ext/standard/link.c diff -u php-src/ext/standard/link.c:1.52 php-src/ext/standard/link.c:1.53 --- php-src/ext/standard/link.c:1.52 Wed Aug 3 10:08:08 2005 +++ php-src/ext/standard/link.c Tue Aug 23 08:53:28 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: link.c,v 1.52 2005/08/03 14:08:08 sniper Exp $ */ +/* $Id: link.c,v 1.53 2005/08/23 12:53:28 dmitry Exp $ */ #include "php.h" #include "php_filestat.h" @@ -80,7 +80,7 @@ /* Append NULL to the end of the string */ buff[ret] = '\0'; - RETURN_STRING(buff, 1); + RETURN_RT_STRING(buff, 1); } /* }}} */ http://cvs.php.net/diff.php/php-src/ext/standard/string.c?r1=1.471&r2=1.472&ty=u Index: php-src/ext/standard/string.c diff -u php-src/ext/standard/string.c:1.471 php-src/ext/standard/string.c:1.472 --- php-src/ext/standard/string.c:1.471 Tue Aug 23 05:33:46 2005 +++ php-src/ext/standard/string.c Tue Aug 23 08:53:28 2005 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c,v 1.471 2005/08/23 09:33:46 dmitry Exp $ */ +/* $Id: string.c,v 1.472 2005/08/23 12:53:28 dmitry Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -1761,14 +1761,17 @@ ret = estrndup(path, path_len); php_dirname(ret, path_len); if (*ret) { - add_assoc_string(tmp, "dirname", ret, 1); + add_assoc_rt_string(tmp, "dirname", ret, 1); } efree(ret); } if ((opt & PHP_PATHINFO_BASENAME) == PHP_PATHINFO_BASENAME) { php_basename(path, path_len, NULL, 0, &ret, &ret_len TSRMLS_CC); - add_assoc_stringl(tmp, "basename", ret, ret_len, 0); + add_assoc_rt_stringl(tmp, "basename", ret, ret_len, 0); + if (UG(unicode)) { + efree(ret); + } } if ((opt & PHP_PATHINFO_EXTENSION) == PHP_PATHINFO_EXTENSION) { @@ -1785,7 +1788,7 @@ if (p) { idx = p - ret; - add_assoc_stringl(tmp, "extension", ret + idx + 1, ret_len - idx - 1, 1); + add_assoc_rt_stringl(tmp, "extension", ret + idx + 1, ret_len - idx - 1, 1); } if (!have_basename) { http://cvs.php.net/diff.php/php-src/ext/standard/type.c?r1=1.35&r2=1.36&ty=u Index: php-src/ext/standard/type.c diff -u php-src/ext/standard/type.c:1.35 php-src/ext/standard/type.c:1.36 --- php-src/ext/standard/type.c:1.35 Mon Aug 22 08:22:15 2005 +++ php-src/ext/standard/type.c Tue Aug 23 08:53:30 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: type.c,v 1.35 2005/08/22 12:22:15 dmitry Exp $ */ +/* $Id: type.c,v 1.36 2005/08/23 12:53:30 dmitry Exp $ */ #include "php.h" #include "php_incomplete_class.h" @@ -33,39 +33,39 @@ switch (Z_TYPE_PP(arg)) { case IS_NULL: - RETVAL_STRING("NULL", 1); + RETVAL_ASCII_STRING("NULL", 1); break; case IS_BOOL: - RETVAL_STRING("boolean", 1); + RETVAL_ASCII_STRING("boolean", 1); break; case IS_LONG: - RETVAL_STRING("integer", 1); + RETVAL_ASCII_STRING("integer", 1); break; case IS_DOUBLE: - RETVAL_STRING("double", 1); + RETVAL_ASCII_STRING("double", 1); break; case IS_STRING: - RETVAL_STRING("string", 1); + RETVAL_ASCII_STRING("string", 1); break; case IS_BINARY: - RETVAL_STRING("binary", 1); + RETVAL_ASCII_STRING("binary", 1); break; case IS_UNICODE: - RETVAL_STRING("unicode", 1); + RETVAL_ASCII_STRING("unicode", 1); break; case IS_ARRAY: - RETVAL_STRING("array", 1); + RETVAL_ASCII_STRING("array", 1); break; case IS_OBJECT: - RETVAL_STRING("object", 1); + RETVAL_ASCII_STRING("object", 1); /* { char *result; @@ -84,13 +84,13 @@ char *type_name; type_name = zend_rsrc_list_get_rsrc_type(Z_LVAL_PP(arg) TSRMLS_CC); if (type_name) { - RETVAL_STRING("resource", 1); + RETVAL_ASCII_STRING("resource", 1); break; } } default: - RETVAL_STRING("unknown type", 1); + RETVAL_ASCII_STRING("unknown type", 1); } } /* }}} */ @@ -368,6 +368,15 @@ } break; + case IS_UNICODE: + result = is_numeric_unicode(Z_USTRVAL_PP(arg), Z_USTRLEN_PP(arg), NULL, NULL, 0); + if (result == IS_LONG || result == IS_DOUBLE) { + RETURN_TRUE; + } else { + RETURN_FALSE; + } + break; + default: RETURN_FALSE; break; http://cvs.php.net/diff.php/php-src/ext/standard/uniqid.c?r1=1.41&r2=1.42&ty=u Index: php-src/ext/standard/uniqid.c diff -u php-src/ext/standard/uniqid.c:1.41 php-src/ext/standard/uniqid.c:1.42 --- php-src/ext/standard/uniqid.c:1.41 Wed Aug 3 10:08:14 2005 +++ php-src/ext/standard/uniqid.c Tue Aug 23 08:53:30 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: uniqid.c,v 1.41 2005/08/03 14:08:14 sniper Exp $ */ +/* $Id: uniqid.c,v 1.42 2005/08/23 12:53:30 dmitry Exp $ */ #include "php.h" @@ -81,7 +81,7 @@ spprintf(&uniqid, 0, "%s%08x%05x", prefix, sec, usec); } - RETURN_STRING(uniqid, 0); + RETURN_RT_STRING(uniqid, 0); } #endif /* }}} */ http://cvs.php.net/diff.php/php-src/ext/standard/tests/file/userdirstream.phpt?r1=1.1&r2=1.2&ty=u Index: php-src/ext/standard/tests/file/userdirstream.phpt diff -u php-src/ext/standard/tests/file/userdirstream.phpt:1.1 php-src/ext/standard/tests/file/userdirstream.phpt:1.2 --- php-src/ext/standard/tests/file/userdirstream.phpt:1.1 Wed Mar 17 15:48:12 2004 +++ php-src/ext/standard/tests/file/userdirstream.phpt Tue Aug 23 08:53:30 2005 @@ -49,4 +49,16 @@ [3]=> string(5) "third" } - +--UEXPECT-- +Opening +Closing up! +array(4) { + [0]=> + unicode(5) "first" + [1]=> + unicode(6) "fourth" + [2]=> + unicode(6) "second" + [3]=> + unicode(5) "third" +} http://cvs.php.net/diff.php/php-src/ext/standard/tests/strings/bug24098.phpt?r1=1.2&r2=1.3&ty=u Index: php-src/ext/standard/tests/strings/bug24098.phpt diff -u php-src/ext/standard/tests/strings/bug24098.phpt:1.2 php-src/ext/standard/tests/strings/bug24098.phpt:1.3 --- php-src/ext/standard/tests/strings/bug24098.phpt:1.2 Fri Dec 5 08:42:04 2003 +++ php-src/ext/standard/tests/strings/bug24098.phpt Tue Aug 23 08:53:30 2005 @@ -15,3 +15,12 @@ ["extension"]=> string(3) "asa" } +--UEXPECT-- +array(3) { + [u"dirname"]=> + unicode(1) "/" + [u"basename"]=> + unicode(8) "dsds.asa" + [u"extension"]=> + unicode(3) "asa" +} http://cvs.php.net/diff.php/php-src/tests/reflection/parameters_001.phpt?r1=1.3&r2=1.4&ty=u Index: php-src/tests/reflection/parameters_001.phpt diff -u php-src/tests/reflection/parameters_001.phpt:1.3 php-src/tests/reflection/parameters_001.phpt:1.4 --- php-src/tests/reflection/parameters_001.phpt:1.3 Mon Aug 2 19:10:53 2004 +++ php-src/tests/reflection/parameters_001.phpt Tue Aug 23 08:53:31 2005 @@ -36,3 +36,10 @@ bool(true) string(54) "The parameter specified by its name could not be found" ===DONE=== +--UEXPECT-- +int(2) +int(1) +bool(false) +bool(true) +unicode(54) "The parameter specified by its name could not be found" +===DONE===
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php