cvs: ZendEngine2 / zend.c zend_constants.c zend_globals.h zend_unicode.c zend_unicode.h
| From: | Andrei Zmievski | Date: | Thu, 23 Mar 2006 22:00:42 +0000 |
| Subject: | cvs: ZendEngine2 / zend.c zend_constants.c zend_globals.h zend_unicode.c zend_unicode.h | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-4761@lists.php.net to get a copy of this message | ||
andrei Thu Mar 23 22:00:42 2006 UTC
Modified files:
/ZendEngine2 zend.c zend_constants.c zend_globals.h zend_unicode.c
zend_unicode.h
Log:
Update conversion error behavior and add some new modes.
# The various escape modes are what ICU calls them. We may want to come
# up with different names for UNICODE/ICU/JAVA ones..
http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend.c?r1=1.344&r2=1.345&diff_format=u Index: ZendEngine2/zend.c diff -u ZendEngine2/zend.c:1.344 ZendEngine2/zend.c:1.345 --- ZendEngine2/zend.c:1.344 Fri Mar 17 08:34:34 2006 +++ ZendEngine2/zend.c Thu Mar 23 22:00:42 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend.c,v 1.344 2006/03/17 08:34:34 dmitry Exp $ */ +/* $Id: zend.c,v 1.345 2006/03/23 22:00:42 andrei Exp $ */ #include "zend.h" #include "zend_extensions.h" @@ -173,9 +173,15 @@ static ZEND_INI_MH(OnUpdateConversionErrorMode) { if (!new_value) { - UG(from_u_error_mode) = ZEND_FROM_U_ERROR_SUBST; + UG(from_u_error_mode) = ZEND_CONV_ERROR_SUBST; } else { - UG(from_u_error_mode) = atoi(new_value); + uint16_t mode = atoi(new_value); + + if ((mode & 0xff) > ZEND_CONV_ERROR_LAST_ENUM) { + zend_error(E_WARNING, "Illegal value for conversion error mode"); + return FAILURE; + } + UG(from_u_error_mode) = mode; } zend_update_converters_error_behavior(TSRMLS_C); return SUCCESS; @@ -194,7 +200,7 @@ zend_error(E_WARNING, "Substitution character string should be a hexadecimal Unicode codepoint value"); return FAILURE; } - if (c < 0 || c >= 0x10FFFF) { + if (c < 0 || c >= UCHAR_MAX_VALUE) { zend_error(E_WARNING, "Substitution character value U+%06x is out of range 0-10FFFF", c); return FAILURE; } @@ -952,7 +958,7 @@ unicode_globals->http_input_encoding_conv = NULL; unicode_globals->subst_char_len = 0; zend_set_converter_encoding(&unicode_globals->utf8_conv, "UTF-8"); - unicode_globals->from_u_error_mode = ZEND_FROM_U_ERROR_SUBST; + unicode_globals->from_u_error_mode = ZEND_CONV_ERROR_SUBST; zend_hash_init_ex(&unicode_globals->flex_compatible, 0, NULL, NULL, 1, 0); } http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_constants.c?r1=1.84&r2=1.85&diff_format=u Index: ZendEngine2/zend_constants.c diff -u ZendEngine2/zend_constants.c:1.84 ZendEngine2/zend_constants.c:1.85 --- ZendEngine2/zend_constants.c:1.84 Wed Mar 15 09:04:48 2006 +++ ZendEngine2/zend_constants.c Thu Mar 23 22:00:42 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_constants.c,v 1.84 2006/03/15 09:04:48 dmitry Exp $ */ +/* $Id: zend_constants.c,v 1.85 2006/03/23 22:00:42 andrei Exp $ */ #include "zend.h" #include "zend_constants.h" @@ -116,10 +116,15 @@ REGISTER_MAIN_LONG_CONSTANT("E_ALL", E_ALL, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_LONG_CONSTANT("U_INVALID_STOP", ZEND_FROM_U_ERROR_STOP, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_LONG_CONSTANT("U_INVALID_SKIP", ZEND_FROM_U_ERROR_SKIP, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_LONG_CONSTANT("U_INVALID_SUBSTITUTE", ZEND_FROM_U_ERROR_SUBST, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_LONG_CONSTANT("U_INVALID_ESCAPE", ZEND_FROM_U_ERROR_ESCAPE, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("U_CONV_ERROR_STOP", ZEND_CONV_ERROR_STOP, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("U_CONV_ERROR_SKIP", ZEND_CONV_ERROR_SKIP, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("U_CONV_ERROR_SUBST", ZEND_CONV_ERROR_SUBST, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("U_CONV_ERROR_ESCAPE_UNICODE", ZEND_CONV_ERROR_ESCAPE_UNICODE, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("U_CONV_ERROR_ESCAPE_ICU", ZEND_CONV_ERROR_ESCAPE_ICU, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("U_CONV_ERROR_ESCAPE_JAVA", ZEND_CONV_ERROR_ESCAPE_JAVA, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("U_CONV_ERROR_ESCAPE_XML_DEC", ZEND_CONV_ERROR_ESCAPE_XML_DEC, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("U_CONV_ERROR_ESCAPE_XML_HEX", ZEND_CONV_ERROR_ESCAPE_XML_HEX, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("U_CONV_ERROR_EXCEPTION", ZEND_CONV_ERROR_EXCEPTION, CONST_PERSISTENT | CONST_CS); /* true/false constants */ { http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_globals.h?r1=1.151&r2=1.152&diff_format=u Index: ZendEngine2/zend_globals.h diff -u ZendEngine2/zend_globals.h:1.151 ZendEngine2/zend_globals.h:1.152 --- ZendEngine2/zend_globals.h:1.151 Thu Mar 16 11:32:00 2006 +++ ZendEngine2/zend_globals.h Thu Mar 23 22:00:42 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_globals.h,v 1.151 2006/03/16 11:32:00 dmitry Exp $ */ +/* $Id: zend_globals.h,v 1.152 2006/03/23 22:00:42 andrei Exp $ */ #ifndef ZEND_GLOBALS_H #define ZEND_GLOBALS_H @@ -301,7 +301,7 @@ UConverter *http_input_encoding_conv;/* http input encoding converter */ UConverter *utf8_conv; /* all-purpose UTF-8 converter */ - uint8_t from_u_error_mode; + uint16_t from_u_error_mode; UChar subst_char[3]; uint8_t subst_char_len; http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_unicode.c?r1=1.9&r2=1.10&diff_format=u Index: ZendEngine2/zend_unicode.c diff -u ZendEngine2/zend_unicode.c:1.9 ZendEngine2/zend_unicode.c:1.10 --- ZendEngine2/zend_unicode.c:1.9 Thu Mar 2 13:12:44 2006 +++ ZendEngine2/zend_unicode.c Thu Mar 23 22:00:42 2006 @@ -35,21 +35,36 @@ UErrorCode status = U_ZERO_ERROR; switch (error_mode) { - case ZEND_FROM_U_ERROR_STOP: + case ZEND_CONV_ERROR_STOP: ucnv_setFromUCallBack(conv, UCNV_FROM_U_CALLBACK_STOP, NULL, NULL, NULL, &status); break; - case ZEND_FROM_U_ERROR_SKIP: + case ZEND_CONV_ERROR_SKIP: ucnv_setFromUCallBack(conv, UCNV_FROM_U_CALLBACK_SKIP, UCNV_SKIP_STOP_ON_ILLEGAL, NULL, NULL, &status); break; - case ZEND_FROM_U_ERROR_ESCAPE: - /* UTODO replace with custom callback for various substitution patterns */ + case ZEND_CONV_ERROR_SUBST: + ucnv_setFromUCallBack(conv, UCNV_FROM_U_CALLBACK_SUBSTITUTE, UCNV_SUB_STOP_ON_ILLEGAL, NULL, NULL, &status); + break; + + case ZEND_CONV_ERROR_ESCAPE_UNICODE: ucnv_setFromUCallBack(conv, UCNV_FROM_U_CALLBACK_ESCAPE, UCNV_ESCAPE_UNICODE, NULL, NULL, &status); break; - case ZEND_FROM_U_ERROR_SUBST: - ucnv_setFromUCallBack(conv, UCNV_FROM_U_CALLBACK_SUBSTITUTE, UCNV_SKIP_STOP_ON_ILLEGAL, NULL, NULL, &status); + case ZEND_CONV_ERROR_ESCAPE_ICU: + ucnv_setFromUCallBack(conv, UCNV_FROM_U_CALLBACK_ESCAPE, UCNV_ESCAPE_ICU, NULL, NULL, &status); + break; + + case ZEND_CONV_ERROR_ESCAPE_JAVA: + ucnv_setFromUCallBack(conv, UCNV_FROM_U_CALLBACK_ESCAPE, UCNV_ESCAPE_JAVA, NULL, NULL, &status); + break; + + case ZEND_CONV_ERROR_ESCAPE_XML_DEC: + ucnv_setFromUCallBack(conv, UCNV_FROM_U_CALLBACK_ESCAPE, UCNV_ESCAPE_XML_DEC, NULL, NULL, &status); + break; + + case ZEND_CONV_ERROR_ESCAPE_XML_HEX: + ucnv_setFromUCallBack(conv, UCNV_FROM_U_CALLBACK_ESCAPE, UCNV_ESCAPE_XML_HEX, NULL, NULL, &status); break; default: @@ -317,50 +332,6 @@ char *s = NULL; int s_len; -#if 0 - /* UTODO Putting it here for now, until we figure out the framework */ - switch (UG(from_u_error_mode)) { - case ZEND_FROM_U_ERROR_STOP: - ucnv_setFromUCallBack(UG(runtime_encoding_conv), UCNV_FROM_U_CALLBACK_STOP, NULL, NULL, NULL, &status); - break; - - case ZEND_FROM_U_ERROR_SKIP: - ucnv_setFromUCallBack(UG(runtime_encoding_conv), UCNV_FROM_U_CALLBACK_SKIP, NULL, NULL, NULL, &status); - break; - - case ZEND_FROM_U_ERROR_ESCAPE: - ucnv_setFromUCallBack(UG(runtime_encoding_conv), UCNV_FROM_U_CALLBACK_ESCAPE, UCNV_ESCAPE_UNICODE, NULL, NULL, &status); - break; - - case ZEND_FROM_U_ERROR_SUBST: - ucnv_setFromUCallBack(UG(runtime_encoding_conv), UCNV_FROM_U_CALLBACK_SUBSTITUTE, NULL, NULL, NULL, &status); - break; - - default: - assert(0); - break; - } - - if (UG(subst_chars)) { - char subchar[16]; - int8_t char_len = 16; - status = U_ZERO_ERROR; - ucnv_getSubstChars(UG(runtime_encoding_conv), subchar, &char_len, &status); - if (U_FAILURE(status)) { - zend_error(E_WARNING, "Could not get substitution characters"); - return FAILURE; - } - status = U_ZERO_ERROR; - ucnv_setSubstChars(UG(runtime_encoding_conv), UG(subst_chars), MIN(char_len, UG(subst_chars_len)), &status); - if (U_FAILURE(status)) { - zend_error(E_WARNING, "Could not set substitution characters"); - return FAILURE; - } - } - - status = U_ZERO_ERROR; -#endif - UChar *u = Z_USTRVAL_P(string); int u_len = Z_USTRLEN_P(string); http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_unicode.h?r1=1.9&r2=1.10&diff_format=u Index: ZendEngine2/zend_unicode.h diff -u ZendEngine2/zend_unicode.h:1.9 ZendEngine2/zend_unicode.h:1.10 --- ZendEngine2/zend_unicode.h:1.9 Thu Mar 2 13:12:44 2006 +++ ZendEngine2/zend_unicode.h Thu Mar 23 22:00:42 2006 @@ -28,10 +28,20 @@ #include <unicode/uloc.h> #include <unicode/ucol.h> -#define ZEND_FROM_U_ERROR_STOP 0 -#define ZEND_FROM_U_ERROR_SKIP 1 -#define ZEND_FROM_U_ERROR_SUBST 2 -#define ZEND_FROM_U_ERROR_ESCAPE 3 +enum { + ZEND_CONV_ERROR_STOP, + ZEND_CONV_ERROR_SKIP, + ZEND_CONV_ERROR_SUBST, + ZEND_CONV_ERROR_ESCAPE_UNICODE, + ZEND_CONV_ERROR_ESCAPE_ICU, + ZEND_CONV_ERROR_ESCAPE_JAVA, + ZEND_CONV_ERROR_ESCAPE_XML_DEC, + ZEND_CONV_ERROR_ESCAPE_XML_HEX, + ZEND_CONV_ERROR_LAST_ENUM, + + ZEND_CONV_ERROR_EXCEPTION = 0x100 +}; + /* internal functions */
http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend.c?r1=1.344&r2=1.345&diff_format=u Index: ZendEngine2/zend.c diff -u ZendEngine2/zend.c:1.344 ZendEngine2/zend.c:1.345 --- ZendEngine2/zend.c:1.344 Fri Mar 17 08:34:34 2006 +++ ZendEngine2/zend.c Thu Mar 23 22:00:42 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend.c,v 1.344 2006/03/17 08:34:34 dmitry Exp $ */ +/* $Id: zend.c,v 1.345 2006/03/23 22:00:42 andrei Exp $ */ #include "zend.h" #include "zend_extensions.h" @@ -173,9 +173,15 @@ static ZEND_INI_MH(OnUpdateConversionErrorMode) { if (!new_value) { - UG(from_u_error_mode) = ZEND_FROM_U_ERROR_SUBST; + UG(from_u_error_mode) = ZEND_CONV_ERROR_SUBST; } else { - UG(from_u_error_mode) = atoi(new_value); + uint16_t mode = atoi(new_value); + + if ((mode & 0xff) > ZEND_CONV_ERROR_LAST_ENUM) { + zend_error(E_WARNING, "Illegal value for conversion error mode"); + return FAILURE; + } + UG(from_u_error_mode) = mode; } zend_update_converters_error_behavior(TSRMLS_C); return SUCCESS; @@ -194,7 +200,7 @@ zend_error(E_WARNING, "Substitution character string should be a hexadecimal Unicode codepoint value"); return FAILURE; } - if (c < 0 || c >= 0x10FFFF) { + if (c < 0 || c >= UCHAR_MAX_VALUE) { zend_error(E_WARNING, "Substitution character value U+%06x is out of range 0-10FFFF", c); return FAILURE; } @@ -952,7 +958,7 @@ unicode_globals->http_input_encoding_conv = NULL; unicode_globals->subst_char_len = 0; zend_set_converter_encoding(&unicode_globals->utf8_conv, "UTF-8"); - unicode_globals->from_u_error_mode = ZEND_FROM_U_ERROR_SUBST; + unicode_globals->from_u_error_mode = ZEND_CONV_ERROR_SUBST; zend_hash_init_ex(&unicode_globals->flex_compatible, 0, NULL, NULL, 1, 0); } http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_constants.c?r1=1.84&r2=1.85&diff_format=u Index: ZendEngine2/zend_constants.c diff -u ZendEngine2/zend_constants.c:1.84 ZendEngine2/zend_constants.c:1.85 --- ZendEngine2/zend_constants.c:1.84 Wed Mar 15 09:04:48 2006 +++ ZendEngine2/zend_constants.c Thu Mar 23 22:00:42 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_constants.c,v 1.84 2006/03/15 09:04:48 dmitry Exp $ */ +/* $Id: zend_constants.c,v 1.85 2006/03/23 22:00:42 andrei Exp $ */ #include "zend.h" #include "zend_constants.h" @@ -116,10 +116,15 @@ REGISTER_MAIN_LONG_CONSTANT("E_ALL", E_ALL, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_LONG_CONSTANT("U_INVALID_STOP", ZEND_FROM_U_ERROR_STOP, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_LONG_CONSTANT("U_INVALID_SKIP", ZEND_FROM_U_ERROR_SKIP, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_LONG_CONSTANT("U_INVALID_SUBSTITUTE", ZEND_FROM_U_ERROR_SUBST, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_LONG_CONSTANT("U_INVALID_ESCAPE", ZEND_FROM_U_ERROR_ESCAPE, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("U_CONV_ERROR_STOP", ZEND_CONV_ERROR_STOP, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("U_CONV_ERROR_SKIP", ZEND_CONV_ERROR_SKIP, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("U_CONV_ERROR_SUBST", ZEND_CONV_ERROR_SUBST, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("U_CONV_ERROR_ESCAPE_UNICODE", ZEND_CONV_ERROR_ESCAPE_UNICODE, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("U_CONV_ERROR_ESCAPE_ICU", ZEND_CONV_ERROR_ESCAPE_ICU, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("U_CONV_ERROR_ESCAPE_JAVA", ZEND_CONV_ERROR_ESCAPE_JAVA, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("U_CONV_ERROR_ESCAPE_XML_DEC", ZEND_CONV_ERROR_ESCAPE_XML_DEC, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("U_CONV_ERROR_ESCAPE_XML_HEX", ZEND_CONV_ERROR_ESCAPE_XML_HEX, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("U_CONV_ERROR_EXCEPTION", ZEND_CONV_ERROR_EXCEPTION, CONST_PERSISTENT | CONST_CS); /* true/false constants */ { http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_globals.h?r1=1.151&r2=1.152&diff_format=u Index: ZendEngine2/zend_globals.h diff -u ZendEngine2/zend_globals.h:1.151 ZendEngine2/zend_globals.h:1.152 --- ZendEngine2/zend_globals.h:1.151 Thu Mar 16 11:32:00 2006 +++ ZendEngine2/zend_globals.h Thu Mar 23 22:00:42 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_globals.h,v 1.151 2006/03/16 11:32:00 dmitry Exp $ */ +/* $Id: zend_globals.h,v 1.152 2006/03/23 22:00:42 andrei Exp $ */ #ifndef ZEND_GLOBALS_H #define ZEND_GLOBALS_H @@ -301,7 +301,7 @@ UConverter *http_input_encoding_conv;/* http input encoding converter */ UConverter *utf8_conv; /* all-purpose UTF-8 converter */ - uint8_t from_u_error_mode; + uint16_t from_u_error_mode; UChar subst_char[3]; uint8_t subst_char_len; http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_unicode.c?r1=1.9&r2=1.10&diff_format=u Index: ZendEngine2/zend_unicode.c diff -u ZendEngine2/zend_unicode.c:1.9 ZendEngine2/zend_unicode.c:1.10 --- ZendEngine2/zend_unicode.c:1.9 Thu Mar 2 13:12:44 2006 +++ ZendEngine2/zend_unicode.c Thu Mar 23 22:00:42 2006 @@ -35,21 +35,36 @@ UErrorCode status = U_ZERO_ERROR; switch (error_mode) { - case ZEND_FROM_U_ERROR_STOP: + case ZEND_CONV_ERROR_STOP: ucnv_setFromUCallBack(conv, UCNV_FROM_U_CALLBACK_STOP, NULL, NULL, NULL, &status); break; - case ZEND_FROM_U_ERROR_SKIP: + case ZEND_CONV_ERROR_SKIP: ucnv_setFromUCallBack(conv, UCNV_FROM_U_CALLBACK_SKIP, UCNV_SKIP_STOP_ON_ILLEGAL, NULL, NULL, &status); break; - case ZEND_FROM_U_ERROR_ESCAPE: - /* UTODO replace with custom callback for various substitution patterns */ + case ZEND_CONV_ERROR_SUBST: + ucnv_setFromUCallBack(conv, UCNV_FROM_U_CALLBACK_SUBSTITUTE, UCNV_SUB_STOP_ON_ILLEGAL, NULL, NULL, &status); + break; + + case ZEND_CONV_ERROR_ESCAPE_UNICODE: ucnv_setFromUCallBack(conv, UCNV_FROM_U_CALLBACK_ESCAPE, UCNV_ESCAPE_UNICODE, NULL, NULL, &status); break; - case ZEND_FROM_U_ERROR_SUBST: - ucnv_setFromUCallBack(conv, UCNV_FROM_U_CALLBACK_SUBSTITUTE, UCNV_SKIP_STOP_ON_ILLEGAL, NULL, NULL, &status); + case ZEND_CONV_ERROR_ESCAPE_ICU: + ucnv_setFromUCallBack(conv, UCNV_FROM_U_CALLBACK_ESCAPE, UCNV_ESCAPE_ICU, NULL, NULL, &status); + break; + + case ZEND_CONV_ERROR_ESCAPE_JAVA: + ucnv_setFromUCallBack(conv, UCNV_FROM_U_CALLBACK_ESCAPE, UCNV_ESCAPE_JAVA, NULL, NULL, &status); + break; + + case ZEND_CONV_ERROR_ESCAPE_XML_DEC: + ucnv_setFromUCallBack(conv, UCNV_FROM_U_CALLBACK_ESCAPE, UCNV_ESCAPE_XML_DEC, NULL, NULL, &status); + break; + + case ZEND_CONV_ERROR_ESCAPE_XML_HEX: + ucnv_setFromUCallBack(conv, UCNV_FROM_U_CALLBACK_ESCAPE, UCNV_ESCAPE_XML_HEX, NULL, NULL, &status); break; default: @@ -317,50 +332,6 @@ char *s = NULL; int s_len; -#if 0 - /* UTODO Putting it here for now, until we figure out the framework */ - switch (UG(from_u_error_mode)) { - case ZEND_FROM_U_ERROR_STOP: - ucnv_setFromUCallBack(UG(runtime_encoding_conv), UCNV_FROM_U_CALLBACK_STOP, NULL, NULL, NULL, &status); - break; - - case ZEND_FROM_U_ERROR_SKIP: - ucnv_setFromUCallBack(UG(runtime_encoding_conv), UCNV_FROM_U_CALLBACK_SKIP, NULL, NULL, NULL, &status); - break; - - case ZEND_FROM_U_ERROR_ESCAPE: - ucnv_setFromUCallBack(UG(runtime_encoding_conv), UCNV_FROM_U_CALLBACK_ESCAPE, UCNV_ESCAPE_UNICODE, NULL, NULL, &status); - break; - - case ZEND_FROM_U_ERROR_SUBST: - ucnv_setFromUCallBack(UG(runtime_encoding_conv), UCNV_FROM_U_CALLBACK_SUBSTITUTE, NULL, NULL, NULL, &status); - break; - - default: - assert(0); - break; - } - - if (UG(subst_chars)) { - char subchar[16]; - int8_t char_len = 16; - status = U_ZERO_ERROR; - ucnv_getSubstChars(UG(runtime_encoding_conv), subchar, &char_len, &status); - if (U_FAILURE(status)) { - zend_error(E_WARNING, "Could not get substitution characters"); - return FAILURE; - } - status = U_ZERO_ERROR; - ucnv_setSubstChars(UG(runtime_encoding_conv), UG(subst_chars), MIN(char_len, UG(subst_chars_len)), &status); - if (U_FAILURE(status)) { - zend_error(E_WARNING, "Could not set substitution characters"); - return FAILURE; - } - } - - status = U_ZERO_ERROR; -#endif - UChar *u = Z_USTRVAL_P(string); int u_len = Z_USTRLEN_P(string); http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_unicode.h?r1=1.9&r2=1.10&diff_format=u Index: ZendEngine2/zend_unicode.h diff -u ZendEngine2/zend_unicode.h:1.9 ZendEngine2/zend_unicode.h:1.10 --- ZendEngine2/zend_unicode.h:1.9 Thu Mar 2 13:12:44 2006 +++ ZendEngine2/zend_unicode.h Thu Mar 23 22:00:42 2006 @@ -28,10 +28,20 @@ #include <unicode/uloc.h> #include <unicode/ucol.h> -#define ZEND_FROM_U_ERROR_STOP 0 -#define ZEND_FROM_U_ERROR_SKIP 1 -#define ZEND_FROM_U_ERROR_SUBST 2 -#define ZEND_FROM_U_ERROR_ESCAPE 3 +enum { + ZEND_CONV_ERROR_STOP, + ZEND_CONV_ERROR_SKIP, + ZEND_CONV_ERROR_SUBST, + ZEND_CONV_ERROR_ESCAPE_UNICODE, + ZEND_CONV_ERROR_ESCAPE_ICU, + ZEND_CONV_ERROR_ESCAPE_JAVA, + ZEND_CONV_ERROR_ESCAPE_XML_DEC, + ZEND_CONV_ERROR_ESCAPE_XML_HEX, + ZEND_CONV_ERROR_LAST_ENUM, + + ZEND_CONV_ERROR_EXCEPTION = 0x100 +}; + /* internal functions */