Skip to content

Commit c37b35f

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: Use locale-independent case conversion in mb_send_mail()
2 parents b732b6d + 46315de commit c37b35f

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

ext/mbstring/mbstring.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3374,9 +3374,7 @@ static int _php_mbstr_parse_mail_headers(HashTable *ht, const char *str, size_t
33743374

33753375
if (fld_name != NULL && fld_val != NULL) {
33763376
zval val;
3377-
/* FIXME: some locale free implementation is
3378-
* really required here,,, */
3379-
php_strtoupper(ZSTR_VAL(fld_name), ZSTR_LEN(fld_name));
3377+
zend_str_tolower(ZSTR_VAL(fld_name), ZSTR_LEN(fld_name));
33803378
ZVAL_STR(&val, fld_val);
33813379

33823380
zend_hash_update(ht, fld_name, &val);
@@ -3422,11 +3420,8 @@ static int _php_mbstr_parse_mail_headers(HashTable *ht, const char *str, size_t
34223420
}
34233421
if (fld_name != NULL && fld_val != NULL) {
34243422
zval val;
3425-
/* FIXME: some locale free implementation is
3426-
* really required here,,, */
3427-
php_strtoupper(ZSTR_VAL(fld_name), ZSTR_LEN(fld_name));
3423+
zend_str_tolower(ZSTR_VAL(fld_name), ZSTR_LEN(fld_name));
34283424
ZVAL_STR(&val, fld_val);
3429-
34303425
zend_hash_update(ht, fld_name, &val);
34313426

34323427
zend_string_release_ex(fld_name, 0);
@@ -3512,7 +3507,7 @@ PHP_FUNCTION(mb_send_mail)
35123507
_php_mbstr_parse_mail_headers(&ht_headers, ZSTR_VAL(str_headers), ZSTR_LEN(str_headers));
35133508
}
35143509

3515-
if ((s = zend_hash_str_find(&ht_headers, "CONTENT-TYPE", sizeof("CONTENT-TYPE") - 1))) {
3510+
if ((s = zend_hash_str_find(&ht_headers, "content-type", sizeof("content-type") - 1))) {
35163511
char *tmp;
35173512
char *param_name;
35183513
char *charset = NULL;
@@ -3548,7 +3543,7 @@ PHP_FUNCTION(mb_send_mail)
35483543
suppressed_hdrs.cnt_type = 1;
35493544
}
35503545

3551-
if ((s = zend_hash_str_find(&ht_headers, "CONTENT-TRANSFER-ENCODING", sizeof("CONTENT-TRANSFER-ENCODING") - 1))) {
3546+
if ((s = zend_hash_str_find(&ht_headers, "content-transfer-encoding", sizeof("content-transfer-encoding") - 1))) {
35523547
const mbfl_encoding *_body_enc;
35533548

35543549
ZEND_ASSERT(Z_TYPE_P(s) == IS_STRING);
@@ -3644,7 +3639,7 @@ PHP_FUNCTION(mb_send_mail)
36443639
zend_string_release_ex(str_headers, 0);
36453640
}
36463641

3647-
if (!zend_hash_str_exists(&ht_headers, "MIME-VERSION", sizeof("MIME-VERSION") - 1)) {
3642+
if (!zend_hash_str_exists(&ht_headers, "mime-version", sizeof("mime-version") - 1)) {
36483643
mbfl_memory_device_strncat(&device, PHP_MBSTR_MAIL_MIME_HEADER1, sizeof(PHP_MBSTR_MAIL_MIME_HEADER1) - 1);
36493644
mbfl_memory_device_strncat(&device, "\n", 1);
36503645
}

0 commit comments

Comments
 (0)