fixed #35253 length of the encoded string vilolates a RFC.

This commit is contained in:
Rui Hirokawa 2005-11-19 06:32:20 +00:00
parent 71b8ed31c3
commit 1c23277a91

View File

@ -2294,7 +2294,7 @@ PHP_FUNCTION(mb_list_encodings)
} }
/* }}} */ /* }}} */
/* {{{ proto string mb_encode_mimeheader(string str [, string charset [, string transfer-encoding [, string linefeed]]]) /* {{{ proto string mb_encode_mimeheader(string str [, string charset [, string transfer-encoding [, string linefeed [, int indent]]]])
Converts the string to MIME "encoded-word" in the format of =?charset?(B|Q)?encoded_string?= */ Converts the string to MIME "encoded-word" in the format of =?charset?(B|Q)?encoded_string?= */
PHP_FUNCTION(mb_encode_mimeheader) PHP_FUNCTION(mb_encode_mimeheader)
{ {
@ -2306,12 +2306,13 @@ PHP_FUNCTION(mb_encode_mimeheader)
int trans_enc_name_len; int trans_enc_name_len;
char *linefeed = "\r\n"; char *linefeed = "\r\n";
int linefeed_len; int linefeed_len;
int indent = 0;
mbfl_string_init(&string); mbfl_string_init(&string);
string.no_language = MBSTRG(current_language); string.no_language = MBSTRG(current_language);
string.no_encoding = MBSTRG(current_internal_encoding); string.no_encoding = MBSTRG(current_internal_encoding);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sss", (char **)&string.val, &string.len, &charset_name, &charset_name_len, &trans_enc_name, &trans_enc_name_len, &linefeed, &linefeed_len) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sssl", (char **)&string.val, &string.len, &charset_name, &charset_name_len, &trans_enc_name, &trans_enc_name_len, &linefeed, &linefeed_len, &indent) == FAILURE) {
return; return;
} }
@ -2341,7 +2342,7 @@ PHP_FUNCTION(mb_encode_mimeheader)
} }
mbfl_string_init(&result); mbfl_string_init(&result);
ret = mbfl_mime_header_encode(&string, &result, charset, transenc, linefeed, 0); ret = mbfl_mime_header_encode(&string, &result, charset, transenc, linefeed, indent);
if (ret != NULL) { if (ret != NULL) {
RETVAL_STRINGL((char *)ret->val, ret->len, 0) /* the string is already strdup()'ed */ RETVAL_STRINGL((char *)ret->val, ret->len, 0) /* the string is already strdup()'ed */
} else { } else {