diff options
| author | Rui Hirokawa <hirokawa@php.net> | 2006-11-03 02:26:50 +0000 |
|---|---|---|
| committer | Rui Hirokawa <hirokawa@php.net> | 2006-11-03 02:26:50 +0000 |
| commit | 501025306c4ff2ef83a00cfddc373727483889f1 (patch) | |
| tree | 9a211e9eb8c1a4df7c9516ed3b25697b4ebcd06b /ext/mbstring | |
| parent | 96d597b6a4e3f37c4364b16b97fb0e5f6816508f (diff) | |
| download | php-git-501025306c4ff2ef83a00cfddc373727483889f1.tar.gz | |
fixed illegal encoding detection when mbstring.encoding_translation is enabled.(made by komura)
Diffstat (limited to 'ext/mbstring')
| -rw-r--r-- | ext/mbstring/mb_gpc.c | 3 | ||||
| -rw-r--r-- | ext/mbstring/mbstring.c | 14 |
2 files changed, 14 insertions, 3 deletions
diff --git a/ext/mbstring/mb_gpc.c b/ext/mbstring/mb_gpc.c index 8cfe56a4d1..4508a97553 100644 --- a/ext/mbstring/mb_gpc.c +++ b/ext/mbstring/mb_gpc.c @@ -154,6 +154,8 @@ MBSTRING_API SAPI_TREAT_DATA_FUNC(mbstr_treat_data) info.num_from_encodings = MBSTRG(http_input_list_size); info.from_language = MBSTRG(language); + MBSTRG(illegalchars) = 0; + detected = _php_mb_encoding_handler_ex(&info, array_ptr, res TSRMLS_CC); MBSTRG(http_input_identify) = detected; @@ -346,6 +348,7 @@ out: } if (convd != NULL) { + MBSTRG(illegalchars) += mbfl_buffer_illegalchars(convd); mbfl_buffer_converter_delete(convd); } if (val_list != NULL) { diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 77ce2c07f2..dbf27b77a2 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -933,7 +933,10 @@ PHP_RINIT_FUNCTION(mbstring) MBSTRG(current_http_output_encoding) = MBSTRG(http_output_encoding); MBSTRG(current_filter_illegal_mode) = MBSTRG(filter_illegal_mode); MBSTRG(current_filter_illegal_substchar) = MBSTRG(filter_illegal_substchar); - MBSTRG(illegalchars) = 0; + + if (!MBSTRG(encoding_translation)) { + MBSTRG(illegalchars) = 0; + } n = 0; if (MBSTRG(detect_order_list)) { @@ -4053,8 +4056,13 @@ PHP_FUNCTION(mb_check_encoding) if (ret != NULL) { MBSTRG(illegalchars) += illegalchars; - efree(ret->val); - RETURN_BOOL(illegalchars == 0); + if (illegalchars == 0 && strncmp(string.val, ret->val, string.len) == 0) { + efree(ret->val); + RETURN_TRUE; + } else { + efree(ret->val); + RETURN_FALSE; + } } else { RETURN_FALSE; } |
