cvs: ZendEngine2 / zend_API.h
| From: | Andrei Zmievski | Date: | Fri, 15 Dec 2006 22:35:24 +0000 |
| Subject: | cvs: ZendEngine2 / zend_API.h | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-5471@lists.php.net to get a copy of this message | ||
andrei Fri Dec 15 22:35:24 2006 UTC
Modified files:
/ZendEngine2 zend_API.h
Log:
Make all macros (RETURN_*, RETVAL_*, ZVAL_*, add_*) that convert binary
strings to Unicode actually issues errors on failure. I'm surprised we
haven't done this already.
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_API.h?r1=1.271&r2=1.272&diff_format=u Index: ZendEngine2/zend_API.h diff -u ZendEngine2/zend_API.h:1.271 ZendEngine2/zend_API.h:1.272 --- ZendEngine2/zend_API.h:1.271 Thu Dec 7 18:19:21 2006 +++ ZendEngine2/zend_API.h Fri Dec 15 22:35:23 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.h,v 1.271 2006/12/07 18:19:21 andrei Exp $ */ +/* $Id: zend_API.h,v 1.272 2006/12/15 22:35:23 andrei Exp $ */ #ifndef ZEND_API_H #define ZEND_API_H @@ -427,28 +427,28 @@ } while (0) #define add_assoc_rt_stringl_ex(arg, key, key_len, str, length, flags) do { \ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_assoc_unicodel_ex(arg, key, key_len, ___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); \ } \ } while (0) #define add_assoc_utf8_stringl_ex(arg, key, key_len, str, length, flags) do { \ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(UG(utf8_conv), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_assoc_unicodel_ex(arg, key, key_len, ___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); \ } \ @@ -570,28 +570,28 @@ } while (0) #define add_ascii_assoc_rt_stringl_ex(arg, key, key_len, str, length, flags) do { \ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_ascii_assoc_unicodel_ex(arg, key, key_len, ___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); \ } \ } while (0) #define add_ascii_assoc_utf8_stringl_ex(arg, key, key_len, str, length, flags) do { \ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(UG(utf8_conv), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_ascii_assoc_unicodel_ex(arg, key, key_len, ___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); \ } \ @@ -714,28 +714,28 @@ } while (0) #define add_rt_assoc_rt_stringl_ex(arg, key, key_len, str, length, flags) do { \ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_rt_assoc_unicodel_ex(arg, key, key_len, ___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); \ } \ } while (0) #define add_rt_assoc_utf8_stringl_ex(arg, key, key_len, str, length, flags) do { \ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(UG(utf8_conv), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_rt_assoc_unicodel_ex(arg, key, key_len, ___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); \ } \ @@ -858,28 +858,28 @@ } while (0) #define add_utf8_assoc_rt_stringl_ex(arg, key, key_len, str, length, flags) do { \ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_utf8_assoc_unicodel_ex(arg, key, key_len, ___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); \ } \ } while (0) #define add_utf8_assoc_utf8_stringl_ex(arg, key, key_len, str, length, flags) do { \ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(UG(utf8_conv), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_utf8_assoc_unicodel_ex(arg, key, key_len, ___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); \ } \ @@ -1012,28 +1012,28 @@ } while (0) #define add_utf8_property_rt_stringl_ex(arg, key, key_len, str, length, flags) do { \ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_utf8_property_unicodel_ex(arg, key, key_len, ___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); \ } \ } while (0) #define add_utf8_property_utf8_stringl_ex(arg, key, key_len, str, length, flags) do { \ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(UG(utf8_conv), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_utf8_property_unicodel_ex(arg, key, key_len, ___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); \ } \ @@ -1130,28 +1130,28 @@ } while (0) #define add_u_assoc_rt_stringl_ex(arg, type, key, key_len, str, length, flags) do { \ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_u_assoc_unicodel_ex(arg, type, key, key_len, ___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); \ } \ } while (0) #define add_u_assoc_utf8_stringl_ex(arg, type, key, key_len, str, length, flags) do { \ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(UG(utf8_conv), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_u_assoc_unicodel_ex(arg, type, key, key_len, ___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); \ } \ @@ -1274,28 +1274,28 @@ } while (0) #define add_index_rt_stringl(arg, idx, str, length, flags) do {\ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_index_unicodel(arg, idx, ___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); \ } \ } while (0) #define add_index_utf8_stringl(arg, idx, str, length, flags) do { \ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(UG(utf8_conv), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_index_unicodel(arg, idx, ___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); \ } \ @@ -1397,28 +1397,28 @@ } while (0) #define add_next_index_rt_stringl(arg, str, length, flags) do { \ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_next_index_unicodel(arg, ___u_str, ___u_len, 0); \ + } \ if ((flags) & ZSTR_AUTOFREE) { \ efree(str); \ } \ - add_next_index_unicodel(arg, ___u_str, ___u_len, 0); \ } else { \ add_next_index_stringl(arg, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \ } \ } while (0) #define add_next_index_utf8_stringl(arg, str, length, flags) do { \ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(UG(utf8_conv), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_next_index_unicodel(arg, ___u_str, ___u_len, 0); \ + } \ if ((flags) & ZSTR_AUTOFREE) { \ efree(str); \ } \ - add_next_index_unicodel(arg, ___u_str, ___u_len, 0); \ } else { \ add_next_index_stringl(arg, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \ } \ @@ -1643,16 +1643,16 @@ #define ZVAL_U_STRING(conv, z, s, flags) { \ if (UG(unicode)) { \ - UErrorCode status = U_ZERO_ERROR; \ char *__s = (s); \ int __s_len = strlen(__s); \ UChar *u_str; \ int u_len; \ - zend_string_to_unicode_ex(conv, &u_str, &u_len, __s, __s_len, &status); \ + if (zend_string_to_unicode(conv, &u_str, &u_len, __s, __s_len) == SUCCESS) { \ + ZVAL_UNICODEL(z, u_str, u_len, 0); \ + } \ if ((flags) & ZSTR_AUTOFREE) { \ efree(__s); \ } \ - ZVAL_UNICODEL(z, u_str, u_len, 0); \ } else { \ char *__s=(s); \ Z_STRLEN_P(z) = strlen(__s); \ @@ -1663,16 +1663,16 @@ #define ZVAL_U_STRINGL(conv, z, s, l, flags) { \ if (UG(unicode)) { \ - UErrorCode status = U_ZERO_ERROR; \ char *__s = (s); \ int __s_len = (l); \ UChar *u_str; \ int u_len; \ - zend_string_to_unicode_ex(conv, &u_str, &u_len, __s, __s_len, &status); \ + if (zend_string_to_unicode(conv, &u_str, &u_len, __s, __s_len) == SUCCESS) { \ + ZVAL_UNICODEL(z, u_str, u_len, 0); \ + } \ if ((flags) & ZSTR_AUTOFREE) { \ efree(__s); \ } \ - ZVAL_UNICODEL(z, u_str, u_len, 0); \ } else { \ char *__s=(s); int __l=l; \ Z_STRLEN_P(z) = __l; \
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_API.h?r1=1.271&r2=1.272&diff_format=u Index: ZendEngine2/zend_API.h diff -u ZendEngine2/zend_API.h:1.271 ZendEngine2/zend_API.h:1.272 --- ZendEngine2/zend_API.h:1.271 Thu Dec 7 18:19:21 2006 +++ ZendEngine2/zend_API.h Fri Dec 15 22:35:23 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.h,v 1.271 2006/12/07 18:19:21 andrei Exp $ */ +/* $Id: zend_API.h,v 1.272 2006/12/15 22:35:23 andrei Exp $ */ #ifndef ZEND_API_H #define ZEND_API_H @@ -427,28 +427,28 @@ } while (0) #define add_assoc_rt_stringl_ex(arg, key, key_len, str, length, flags) do { \ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_assoc_unicodel_ex(arg, key, key_len, ___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); \ } \ } while (0) #define add_assoc_utf8_stringl_ex(arg, key, key_len, str, length, flags) do { \ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(UG(utf8_conv), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_assoc_unicodel_ex(arg, key, key_len, ___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); \ } \ @@ -570,28 +570,28 @@ } while (0) #define add_ascii_assoc_rt_stringl_ex(arg, key, key_len, str, length, flags) do { \ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_ascii_assoc_unicodel_ex(arg, key, key_len, ___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); \ } \ } while (0) #define add_ascii_assoc_utf8_stringl_ex(arg, key, key_len, str, length, flags) do { \ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(UG(utf8_conv), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_ascii_assoc_unicodel_ex(arg, key, key_len, ___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); \ } \ @@ -714,28 +714,28 @@ } while (0) #define add_rt_assoc_rt_stringl_ex(arg, key, key_len, str, length, flags) do { \ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_rt_assoc_unicodel_ex(arg, key, key_len, ___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); \ } \ } while (0) #define add_rt_assoc_utf8_stringl_ex(arg, key, key_len, str, length, flags) do { \ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(UG(utf8_conv), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_rt_assoc_unicodel_ex(arg, key, key_len, ___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); \ } \ @@ -858,28 +858,28 @@ } while (0) #define add_utf8_assoc_rt_stringl_ex(arg, key, key_len, str, length, flags) do { \ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_utf8_assoc_unicodel_ex(arg, key, key_len, ___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); \ } \ } while (0) #define add_utf8_assoc_utf8_stringl_ex(arg, key, key_len, str, length, flags) do { \ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(UG(utf8_conv), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_utf8_assoc_unicodel_ex(arg, key, key_len, ___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); \ } \ @@ -1012,28 +1012,28 @@ } while (0) #define add_utf8_property_rt_stringl_ex(arg, key, key_len, str, length, flags) do { \ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_utf8_property_unicodel_ex(arg, key, key_len, ___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); \ } \ } while (0) #define add_utf8_property_utf8_stringl_ex(arg, key, key_len, str, length, flags) do { \ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(UG(utf8_conv), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_utf8_property_unicodel_ex(arg, key, key_len, ___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); \ } \ @@ -1130,28 +1130,28 @@ } while (0) #define add_u_assoc_rt_stringl_ex(arg, type, key, key_len, str, length, flags) do { \ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_u_assoc_unicodel_ex(arg, type, key, key_len, ___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); \ } \ } while (0) #define add_u_assoc_utf8_stringl_ex(arg, type, key, key_len, str, length, flags) do { \ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(UG(utf8_conv), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_u_assoc_unicodel_ex(arg, type, key, key_len, ___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); \ } \ @@ -1274,28 +1274,28 @@ } while (0) #define add_index_rt_stringl(arg, idx, str, length, flags) do {\ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_index_unicodel(arg, idx, ___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); \ } \ } while (0) #define add_index_utf8_stringl(arg, idx, str, length, flags) do { \ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(UG(utf8_conv), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_index_unicodel(arg, idx, ___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); \ } \ @@ -1397,28 +1397,28 @@ } while (0) #define add_next_index_rt_stringl(arg, str, length, flags) do { \ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_next_index_unicodel(arg, ___u_str, ___u_len, 0); \ + } \ if ((flags) & ZSTR_AUTOFREE) { \ efree(str); \ } \ - add_next_index_unicodel(arg, ___u_str, ___u_len, 0); \ } else { \ add_next_index_stringl(arg, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \ } \ } while (0) #define add_next_index_utf8_stringl(arg, str, length, flags) do { \ if (UG(unicode)) { \ - UErrorCode ___status = U_ZERO_ERROR; \ UChar *___u_str; \ int ___u_len; \ - zend_string_to_unicode_ex(UG(utf8_conv), &___u_str, &___u_len, str, length, &___status); \ + if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length) == SUCCESS) { \ + add_next_index_unicodel(arg, ___u_str, ___u_len, 0); \ + } \ if ((flags) & ZSTR_AUTOFREE) { \ efree(str); \ } \ - add_next_index_unicodel(arg, ___u_str, ___u_len, 0); \ } else { \ add_next_index_stringl(arg, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \ } \ @@ -1643,16 +1643,16 @@ #define ZVAL_U_STRING(conv, z, s, flags) { \ if (UG(unicode)) { \ - UErrorCode status = U_ZERO_ERROR; \ char *__s = (s); \ int __s_len = strlen(__s); \ UChar *u_str; \ int u_len; \ - zend_string_to_unicode_ex(conv, &u_str, &u_len, __s, __s_len, &status); \ + if (zend_string_to_unicode(conv, &u_str, &u_len, __s, __s_len) == SUCCESS) { \ + ZVAL_UNICODEL(z, u_str, u_len, 0); \ + } \ if ((flags) & ZSTR_AUTOFREE) { \ efree(__s); \ } \ - ZVAL_UNICODEL(z, u_str, u_len, 0); \ } else { \ char *__s=(s); \ Z_STRLEN_P(z) = strlen(__s); \ @@ -1663,16 +1663,16 @@ #define ZVAL_U_STRINGL(conv, z, s, l, flags) { \ if (UG(unicode)) { \ - UErrorCode status = U_ZERO_ERROR; \ char *__s = (s); \ int __s_len = (l); \ UChar *u_str; \ int u_len; \ - zend_string_to_unicode_ex(conv, &u_str, &u_len, __s, __s_len, &status); \ + if (zend_string_to_unicode(conv, &u_str, &u_len, __s, __s_len) == SUCCESS) { \ + ZVAL_UNICODEL(z, u_str, u_len, 0); \ + } \ if ((flags) & ZSTR_AUTOFREE) { \ efree(__s); \ } \ - ZVAL_UNICODEL(z, u_str, u_len, 0); \ } else { \ char *__s=(s); int __l=l; \ Z_STRLEN_P(z) = __l; \