hirokawa Mon Sep 24 11:51:36 2007 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/mbstring/libmbfl/mbfl mbfilter.h mbfl_convert.c
/php-src/ext/mbstring mbstring.c
Log:
MFH: added support "entity" as substitute_character settin accoding to bug
#39404
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/libmbfl/mbfl/mbfilter.h?r1=1.4.2.2&r2=1.4.2.2.2.1&diff_format=u
Index: php-src/ext/mbstring/libmbfl/mbfl/mbfilter.h
diff -u php-src/ext/mbstring/libmbfl/mbfl/mbfilter.h:1.4.2.2
php-src/ext/mbstring/libmbfl/mbfl/mbfilter.h:1.4.2.2.2.1
--- php-src/ext/mbstring/libmbfl/mbfl/mbfilter.h:1.4.2.2 Tue Mar 21
01:58:27 2006
+++ php-src/ext/mbstring/libmbfl/mbfl/mbfilter.h Mon Sep 24 11:51:36 2007
@@ -104,6 +104,7 @@
#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE 0
#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR 1
#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG 2
+#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY 3
/*
* buffering converter
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/libmbfl/mbfl/mbfl_convert.c?r1=1.5.2.1.2.2&r2=1.5.2.1.2.3&diff_format=u
Index: php-src/ext/mbstring/libmbfl/mbfl/mbfl_convert.c
diff -u php-src/ext/mbstring/libmbfl/mbfl/mbfl_convert.c:1.5.2.1.2.2
php-src/ext/mbstring/libmbfl/mbfl/mbfl_convert.c:1.5.2.1.2.3
--- php-src/ext/mbstring/libmbfl/mbfl/mbfl_convert.c:1.5.2.1.2.2 Mon Jan
29 22:53:47 2007
+++ php-src/ext/mbstring/libmbfl/mbfl/mbfl_convert.c Mon Sep 24 11:51:36 2007
@@ -387,9 +387,14 @@
ret = (*filter->filter_function)(filter->illegal_substchar,
filter);
break;
case MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG:
+ case MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY:
if (c >= 0) {
if (c < MBFL_WCSGROUP_UCS4MAX) { /* unicode */
- ret = mbfl_convert_filter_strcat(filter, (const
unsigned char *)"U+");
+ if (mode_backup ==
MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG) {
+ ret = mbfl_convert_filter_strcat(filter, (const
unsigned char *)"U+");
+ } else { /* entity */
+ ret = mbfl_convert_filter_strcat(filter, (const
unsigned char *)"&#");
+ }
} else {
if (c < MBFL_WCSGROUP_WCHARMAX) {
m = c & ~MBFL_WCSPLANE_MASK;
@@ -433,6 +438,9 @@
if (m == 0 && ret >= 0) {
ret =
(*filter->filter_function)(mbfl_hexchar_table[0], filter);
}
+ if (mode_backup ==
MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY) {
+ ret = mbfl_convert_filter_strcat(filter,
(const unsigned char *)";");
+ }
}
}
break;
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.24&r2=1.224.2.22.2.25&diff_format=u
Index: php-src/ext/mbstring/mbstring.c
diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.24
php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25
--- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.24 Thu Jul 12 15:31:54 2007
+++ php-src/ext/mbstring/mbstring.c Mon Sep 24 11:51:36 2007
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mbstring.c,v 1.224.2.22.2.24 2007/07/12 15:31:54 masugata Exp $ */
+/* $Id: mbstring.c,v 1.224.2.22.2.25 2007/09/24 11:51:36 hirokawa Exp $ */
/*
* PHP 4 Multibyte String module "mbstring"
@@ -712,6 +712,9 @@
} else if (strcasecmp("long", new_value) == 0) {
MBSTRG(filter_illegal_mode) =
MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG;
MBSTRG(current_filter_illegal_mode) =
MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG;
+ } else if (strcasecmp("entity", new_value) == 0) {
+ MBSTRG(filter_illegal_mode) =
MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY;
+ MBSTRG(current_filter_illegal_mode) =
MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY;
} else {
MBSTRG(filter_illegal_mode) =
MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
MBSTRG(current_filter_illegal_mode) =
MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
@@ -1329,6 +1332,8 @@
RETVAL_STRING("none", 1);
} else if (MBSTRG(current_filter_illegal_mode) ==
MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG) {
RETVAL_STRING("long", 1);
+ } else if (MBSTRG(current_filter_illegal_mode) ==
MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY) {
+ RETVAL_STRING("entity", 1);
} else {
RETVAL_LONG(MBSTRG(current_filter_illegal_substchar));
}
@@ -1340,6 +1345,8 @@
MBSTRG(current_filter_illegal_mode) =
MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE;
} else if (strcasecmp("long", Z_STRVAL_PP(arg1)) == 0) {
MBSTRG(current_filter_illegal_mode) =
MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG;
+ } else if (strcasecmp("entity", Z_STRVAL_PP(arg1)) ==
0) {
+ MBSTRG(current_filter_illegal_mode) =
MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY;
} else {
convert_to_long_ex(arg1);
if (Z_LVAL_PP(arg1)< 0xffff && Z_LVAL_PP(arg1)>
0x0) {
@@ -3890,6 +3897,8 @@
add_assoc_string(return_value, "substitute_character",
"none", 1);
} else if (MBSTRG(current_filter_illegal_mode) ==
MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG) {
add_assoc_string(return_value, "substitute_character",
"long", 1);
+ } else if (MBSTRG(current_filter_illegal_mode) ==
MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY) {
+ add_assoc_string(return_value, "substitute_character",
"entity", 1);
} else {
add_assoc_long(return_value, "substitute_character",
MBSTRG(current_filter_illegal_substchar));
}
@@ -3984,6 +3993,8 @@
RETVAL_STRING("none", 1);
} else if (MBSTRG(current_filter_illegal_mode) ==
MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG) {
RETVAL_STRING("long", 1);
+ } else if (MBSTRG(current_filter_illegal_mode) ==
MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY) {
+ RETVAL_STRING("entity", 1);
} else {
RETVAL_LONG(MBSTRG(current_filter_illegal_substchar));
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php