diff --git a/NEWS b/NEWS index d982a1008b1d..c254093716ab 100644 --- a/NEWS +++ b/NEWS @@ -119,6 +119,8 @@ PHP NEWS deeply nested arrays. (Eyüp Can Akman) . Fixed the JIT freeing the string returned by mb_encode_mimeheader() or mb_output_handler() while it is still in use. (Ilia Alshanetsky) + . Fixed bug GH-25832 (mb_encode_mimeheader() rejects null for $charset and + $transfer_encoding). (Tomasz Kowalczyk) - MySQLi: . Fixed bug GH-25779 (mysqli_fetch_object() crashes with JIT when the diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 3df3367de07c..4cd9de204cf5 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -6604,8 +6604,8 @@ PHP_FUNCTION(mb_encode_mimeheader) ZEND_PARSE_PARAMETERS_START(1, 5) Z_PARAM_STR(str) Z_PARAM_OPTIONAL - Z_PARAM_STR(charset_name) - Z_PARAM_STR(transenc_name) + Z_PARAM_STR_OR_NULL(charset_name) + Z_PARAM_STR_OR_NULL(transenc_name) Z_PARAM_STRING(linefeed, linefeed_len) Z_PARAM_LONG(indent) ZEND_PARSE_PARAMETERS_END(); diff --git a/ext/mbstring/tests/gh25832.phpt b/ext/mbstring/tests/gh25832.phpt new file mode 100644 index 000000000000..865fd9888bbc --- /dev/null +++ b/ext/mbstring/tests/gh25832.phpt @@ -0,0 +1,19 @@ +--TEST-- +GH-25832: mb_encode_mimeheader() rejects null for $charset and $transfer_encoding +--EXTENSIONS-- +mbstring +--FILE-- + +--EXPECT-- +string(20) "abc =?UTF-8?B?w6k=?=" +string(20) "abc =?UTF-8?B?w6k=?=" +string(20) "abc =?UTF-8?B?w6k=?=" +string(24) "abc =?ISO-8859-1?Q?=E9?="