diff options
-rw-r--r-- | ext/mbstring/mbstring.c | 8 | ||||
-rw-r--r-- | ext/mbstring/tests/bug52861.phpt | 26 | ||||
-rw-r--r-- | ext/mbstring/tests/mb_send_mail01.phpt | 4 | ||||
-rw-r--r-- | ext/mbstring/tests/mb_send_mail02.phpt | 4 | ||||
-rw-r--r-- | ext/mbstring/tests/mb_send_mail03.phpt | 4 | ||||
-rw-r--r-- | ext/mbstring/tests/mb_send_mail04.phpt | 4 | ||||
-rw-r--r-- | ext/mbstring/tests/mb_send_mail05.phpt | 4 | ||||
-rw-r--r-- | ext/mbstring/tests/mb_send_mail06.phpt | 4 | ||||
-rw-r--r-- | ext/mbstring/tests/mb_send_mail07.phpt | 4 |
9 files changed, 45 insertions, 17 deletions
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 4ca4545e97..9b01edbe26 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -4025,7 +4025,7 @@ PHP_FUNCTION(mb_send_mail) } /* other headers */ -#define PHP_MBSTR_MAIL_MIME_HEADER1 "Mime-Version: 1.0" +#define PHP_MBSTR_MAIL_MIME_HEADER1 "MIME-Version: 1.0" #define PHP_MBSTR_MAIL_MIME_HEADER2 "Content-Type: text/plain" #define PHP_MBSTR_MAIL_MIME_HEADER3 "; charset=" #define PHP_MBSTR_MAIL_MIME_HEADER4 "Content-Transfer-Encoding: " @@ -4038,8 +4038,10 @@ PHP_FUNCTION(mb_send_mail) } } - mbfl_memory_device_strncat(&device, PHP_MBSTR_MAIL_MIME_HEADER1, sizeof(PHP_MBSTR_MAIL_MIME_HEADER1) - 1); - mbfl_memory_device_strncat(&device, "\n", 1); + if (!zend_hash_exists(&ht_headers, "MIME-VERSION", sizeof("MIME-VERSION") - 1)) { + mbfl_memory_device_strncat(&device, PHP_MBSTR_MAIL_MIME_HEADER1, sizeof(PHP_MBSTR_MAIL_MIME_HEADER1) - 1); + mbfl_memory_device_strncat(&device, "\n", 1); + } if (!suppressed_hdrs.cnt_type) { mbfl_memory_device_strncat(&device, PHP_MBSTR_MAIL_MIME_HEADER2, sizeof(PHP_MBSTR_MAIL_MIME_HEADER2) - 1); diff --git a/ext/mbstring/tests/bug52861.phpt b/ext/mbstring/tests/bug52861.phpt new file mode 100644 index 0000000000..085f3ba297 --- /dev/null +++ b/ext/mbstring/tests/bug52861.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #52681 (mb_send_mail() appends an extra MIME-Version header) +--SKIPIF-- +<?php +if (!function_exists("mb_send_mail") || !mb_language("neutral")) { + die("skip mb_send_mail() not available"); +} +?> +--INI-- +sendmail_path=/bin/cat +mail.add_x_header=off +--FILE-- +<?php +$to = 'example@example.com'; +$headers = 'MIME-Version: 2.0'; + +mb_send_mail($to, mb_language(), "test", $headers); +?> +--EXPECTF-- +To: example@example.com +Subject: %s +MIME-Version: 2.0 +Content-Type: text/plain; charset=%s +Content-Transfer-Encoding: %s + +%s diff --git a/ext/mbstring/tests/mb_send_mail01.phpt b/ext/mbstring/tests/mb_send_mail01.phpt index 90cc3aa9c6..28a401e311 100644 --- a/ext/mbstring/tests/mb_send_mail01.phpt +++ b/ext/mbstring/tests/mb_send_mail01.phpt @@ -25,14 +25,14 @@ if (mb_language("neutral")) { --EXPECTF-- To: example@example.com Subject: %s -Mime-Version: 1.0 +MIME-Version: 1.0 Content-Type: text/plain; charset=%s Content-Transfer-Encoding: %s %s To: example@example.com Subject: test neutral -Mime-Version: 1.0 +MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: BASE64 diff --git a/ext/mbstring/tests/mb_send_mail02.phpt b/ext/mbstring/tests/mb_send_mail02.phpt index 81f2464d5b..af335ccc58 100644 --- a/ext/mbstring/tests/mb_send_mail02.phpt +++ b/ext/mbstring/tests/mb_send_mail02.phpt @@ -25,14 +25,14 @@ if (mb_language("japanese")) { --EXPECTF-- To: example@example.com Subject: %s -Mime-Version: 1.0 +MIME-Version: 1.0 Content-Type: text/plain; charset=%s Content-Transfer-Encoding: %s %s To: example@example.com Subject: =?ISO-2022-JP?B?GyRCJUYlOSVIGyhCIEphcGFuZXNl?= -Mime-Version: 1.0 +MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit diff --git a/ext/mbstring/tests/mb_send_mail03.phpt b/ext/mbstring/tests/mb_send_mail03.phpt index 1334fadd70..23a988ffe1 100644 --- a/ext/mbstring/tests/mb_send_mail03.phpt +++ b/ext/mbstring/tests/mb_send_mail03.phpt @@ -25,14 +25,14 @@ if (mb_language("english")) { --EXPECTF-- To: example@example.com Subject: %s -Mime-Version: 1.0 +MIME-Version: 1.0 Content-Type: text/plain; charset=%s Content-Transfer-Encoding: %s %s To: example@example.com Subject: test English -Mime-Version: 1.0 +MIME-Version: 1.0 Content-Type: text/plain; charset=%s-8859-1 Content-Transfer-Encoding: 8bit diff --git a/ext/mbstring/tests/mb_send_mail04.phpt b/ext/mbstring/tests/mb_send_mail04.phpt index 0dcc318cc0..49bda090f5 100644 --- a/ext/mbstring/tests/mb_send_mail04.phpt +++ b/ext/mbstring/tests/mb_send_mail04.phpt @@ -25,14 +25,14 @@ if (mb_language("german")) { --EXPECTF-- To: example@example.com Subject: %s -Mime-Version: 1.0 +MIME-Version: 1.0 Content-Type: text/plain; charset=%s Content-Transfer-Encoding: %s %s To: example@example.com Subject: =?ISO-8859-15?Q?Pr=FCfung=20German?= -Mime-Version: 1.0 +MIME-Version: 1.0 Content-Type: text/plain; charset=%s-8859-15 Content-Transfer-Encoding: 8bit diff --git a/ext/mbstring/tests/mb_send_mail05.phpt b/ext/mbstring/tests/mb_send_mail05.phpt index a93fa791a1..1bbaaadcda 100644 --- a/ext/mbstring/tests/mb_send_mail05.phpt +++ b/ext/mbstring/tests/mb_send_mail05.phpt @@ -28,7 +28,7 @@ if (mb_language("simplified chinese")) { --EXPECTF-- To: example@example.com Subject: %s -Mime-Version: 1.0 +MIME-Version: 1.0 Content-Type: text/plain; charset=%s Content-Transfer-Encoding: %s @@ -36,7 +36,7 @@ Content-Transfer-Encoding: %s To: example@example.com Subject: =?HZ-GB-2312?B?fnsyYlFpfn0gU2ltcGxpZmllZCBD?= =?HZ-GB-2312?B?aGluZXNl?= -Mime-Version: 1.0 +MIME-Version: 1.0 Content-Type: text/plain; charset=HZ-GB-2312 Content-Transfer-Encoding: 7bit diff --git a/ext/mbstring/tests/mb_send_mail06.phpt b/ext/mbstring/tests/mb_send_mail06.phpt index 9970340d55..4eb5492bc2 100644 --- a/ext/mbstring/tests/mb_send_mail06.phpt +++ b/ext/mbstring/tests/mb_send_mail06.phpt @@ -28,14 +28,14 @@ if (mb_language("traditional chinese")) { --EXPECTF-- To: example@example.com Subject: %s -Mime-Version: 1.0 +MIME-Version: 1.0 Content-Type: text/plain; charset=%s Content-Transfer-Encoding: %s %s To: example@example.com Subject: =?BIG5?B?tPrF5yBUcmFkaXRpb25hbCBDaGluZXNl?= -Mime-Version: 1.0 +MIME-Version: 1.0 Content-Type: text/plain; charset=BIG5 Content-Transfer-Encoding: 8bit diff --git a/ext/mbstring/tests/mb_send_mail07.phpt b/ext/mbstring/tests/mb_send_mail07.phpt index afd9a0b15c..42b91fa688 100644 --- a/ext/mbstring/tests/mb_send_mail07.phpt +++ b/ext/mbstring/tests/mb_send_mail07.phpt @@ -28,14 +28,14 @@ if (mb_language("korean")) { --EXPECTF-- To: example@example.com Subject: %s -Mime-Version: 1.0 +MIME-Version: 1.0 Content-Type: text/plain; charset=%s Content-Transfer-Encoding: %s %s To: example@example.com Subject: =?ISO-2022-KR?B?GyQpQw5FVz06Ri4PIEtvcmVhbg8=?= -Mime-Version: 1.0 +MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-2022-KR Content-Transfer-Encoding: 7bit |