summaryrefslogtreecommitdiff
path: root/ext/mbstring/mbstring.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mbstring/mbstring.c')
-rw-r--r--ext/mbstring/mbstring.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c
index 7d358280a4..7a1e274fe7 100644
--- a/ext/mbstring/mbstring.c
+++ b/ext/mbstring/mbstring.c
@@ -786,6 +786,7 @@ static void _php_mb_globals_ctor(zend_mbstring_globals *pglobals TSRMLS_DC)
MBSTRG(filter_illegal_substchar) = 0x3f; /* '?' */
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
MBSTRG(current_filter_illegal_substchar) = 0x3f; /* '?' */
+ MBSTRG(illegalchars) = 0;
MBSTRG(func_overload) = 0;
MBSTRG(encoding_translation) = 0;
MBSTRG(strict_detection) = 0;
@@ -928,6 +929,7 @@ 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;
n = 0;
if (MBSTRG(detect_order_list)) {
@@ -996,6 +998,7 @@ PHP_RSHUTDOWN_FUNCTION(mbstring)
MBSTRG(current_detect_order_list_size) = 0;
}
if (MBSTRG(outconv) != NULL) {
+ MBSTRG(illegalchars) += mbfl_buffer_illegalchars(MBSTRG(outconv));
mbfl_buffer_converter_delete(MBSTRG(outconv));
MBSTRG(outconv) = NULL;
}
@@ -1451,6 +1454,7 @@ PHP_FUNCTION(mb_output_handler)
if ((arg_status & PHP_OUTPUT_HANDLER_START) != 0) {
/* delete the converter just in case. */
if (MBSTRG(outconv)) {
+ MBSTRG(illegalchars) += mbfl_buffer_illegalchars(MBSTRG(outconv));
mbfl_buffer_converter_delete(MBSTRG(outconv));
MBSTRG(outconv) = NULL;
}
@@ -1515,6 +1519,7 @@ PHP_FUNCTION(mb_output_handler)
/* delete the converter if it is the last feed. */
if (last_feed) {
+ MBSTRG(illegalchars) += mbfl_buffer_illegalchars(MBSTRG(outconv));
mbfl_buffer_converter_delete(MBSTRG(outconv));
MBSTRG(outconv) = NULL;
}
@@ -2079,6 +2084,7 @@ MBSTRING_API char * php_mb_convert_encoding(char *input, size_t length, char *_t
output = (char *)ret->val;
}
+ MBSTRG(illegalchars) += mbfl_buffer_illegalchars(MBSTRG(outconv));
mbfl_buffer_converter_delete(convd);
return output;
}
@@ -2747,6 +2753,7 @@ detect_end:
}
efree(stack);
+ MBSTRG(illegalchars) += mbfl_buffer_illegalchars(convd);
mbfl_buffer_converter_delete(convd);
}
@@ -3439,6 +3446,8 @@ PHP_FUNCTION(mb_get_info)
if (lang != NULL && (name = (char *)mbfl_no_encoding2name(lang->mail_body_encoding)) != NULL) {
RETVAL_STRING(name, 1);
}
+ } else if (!strcasecmp("illegalchars", typ)) {
+ RETVAL_LONG(MBSTRG(illegalchars));
} else {
RETURN_FALSE;
}
@@ -3605,6 +3614,7 @@ MBSTRING_API int php_mb_gpc_encoding_converter(char **str, int *len, int num, co
str[i] = ret->val;
len[i] = ret->len;
}
+ MBSTRG(illegalchars) += mbfl_buffer_illegalchars(convd);
mbfl_buffer_converter_delete(convd);
}
@@ -3821,6 +3831,7 @@ int php_mb_encoding_converter(char **to, int *to_length, const char *from,
*to = ret->val;
*to_length = ret->len;
}
+ MBSTRG(illegalchars) += mbfl_buffer_illegalchars(convd);
mbfl_buffer_converter_delete(convd);
return ret ? 0 : -1;