]> granicus.if.org Git - php/commitdiff
MFH: fixed a mb_send_mail() bug.
authorMoriyoshi Koizumi <moriyoshi@php.net>
Fri, 31 Jan 2003 14:28:44 +0000 (14:28 +0000)
committerMoriyoshi Koizumi <moriyoshi@php.net>
Fri, 31 Jan 2003 14:28:44 +0000 (14:28 +0000)
# sorry for mixing WS fix

ext/mbstring/mbfilter.c
ext/mbstring/mbstring.c
ext/mbstring/tests/mb_send_mail01.phpt
ext/mbstring/tests/mb_send_mail02.phpt
ext/mbstring/tests/mb_send_mail03.phpt
ext/mbstring/tests/mb_send_mail04.phpt
ext/mbstring/tests/mb_send_mail05.phpt
ext/mbstring/tests/mb_send_mail06.phpt

index 2d44c2be239f565985814d96e23786eb9941e4fc..65f599aa952a317d97e2657fd18e940a11a3cf8e 100644 (file)
@@ -7440,8 +7440,10 @@ mbfl_convert_encoding(
        if (filter1 == NULL) {
                return NULL;
        }
-       filter2->illegal_mode = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
-       filter2->illegal_substchar = 0x3f;              /* '?' */
+       if (filter2 != NULL) {
+               filter2->illegal_mode = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
+               filter2->illegal_substchar = 0x3f;              /* '?' */
+       }
        mbfl_memory_device_init(&device, string->len, (string->len >> 2) + 8 TSRMLS_CC);
 
        /* feed data */
index 75760a9ce86d201c28d656a7a09097bb04b94a66..bd32866d76a4437dae32925742db191cbfbaf183 100644 (file)
@@ -3375,11 +3375,21 @@ PHP_FUNCTION(mb_send_mail)
                    || orig_str.no_encoding == mbfl_no_encoding_pass) {
                        orig_str.no_encoding = mbfl_identify_encoding_no(&orig_str, MBSTRG(current_detect_order_list), MBSTRG(current_detect_order_list_size) TSRMLS_CC);
                }
-               pstr = mbfl_convert_encoding(&orig_str, &conv_str, tran_cs TSRMLS_CC);
+
+               pstr = NULL;
+               {
+                       mbfl_string tmpstr;
+
+                       if (mbfl_convert_encoding(&orig_str, &tmpstr, tran_cs TSRMLS_CC) != NULL) {
+                               tmpstr.no_encoding=mbfl_no_encoding_8bit;
+                               pstr = mbfl_convert_encoding(&tmpstr, &conv_str, body_enc TSRMLS_CC);
+                               efree(tmpstr.val);
+                       }
+               }
                if (pstr != NULL) {
                        message_buf = message = (char *)pstr->val;
                } else {
-                       message = Z_STRVAL_PP(argv[2]);
+                       message = estrndup(Z_STRVAL_PP(argv[2]), Z_STRLEN_PP(argv[2]));
                }
        } else {
                /* this is not really an error, so it is allowed. */
index 55798e9abcf399588c08ec626ba0216a0302d92f..965c857f04df6e01b38d5c9b9b107f3973085bd9 100644 (file)
@@ -28,11 +28,11 @@ Mime-Version: 1.0
 Content-Type: text/plain; charset=%s
 Content-Transfer-Encoding: %s
 
-test
+dGVzdA==
 To: example@example.com
 Subject: test neutral
 Mime-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: BASE64
 
-test
+dGVzdA==
index 6d93fb3afcc46dff07ad52822503126b589e4faf..17a6cef899ab6547aa200e8e559fdc9d8e1f8ba9 100644 (file)
@@ -28,7 +28,7 @@ Mime-Version: 1.0
 Content-Type: text/plain; charset=%s
 Content-Transfer-Encoding: %s
 
-test
+dGVzdA==
 To: example@example.com
 Subject: =?ISO-2022-JP?B?GyRCJUYlOSVIGyhCIEphcGFuZXNl?=
 Mime-Version: 1.0
index 27a8402b60f1ffb31434797824815e8f96f3d721..43ca36a8ac3a8117926e909bbee292f595e80e83 100644 (file)
@@ -28,7 +28,7 @@ Mime-Version: 1.0
 Content-Type: text/plain; charset=%s
 Content-Transfer-Encoding: %s
 
-test
+dGVzdA==
 To: example@example.com
 Subject: test English
 Mime-Version: 1.0
index 05100018f83b6ef8e95c0c7a83b63c149bcadec2..2523351e124a1106e4a5e8d1ddd9cb634bb50ac8 100644 (file)
@@ -28,7 +28,7 @@ Mime-Version: 1.0
 Content-Type: text/plain; charset=%s
 Content-Transfer-Encoding: %s
 
-test
+dGVzdA==
 To: example@example.com
 Subject: =?ISO-8859-15?Q?Pr=FCfung=20German?=
 Mime-Version: 1.0
index b36b41813e22f74c3357c7e4400ba02ae2342683..7eb232f68f393ac417906bb3f071657da87a948d 100644 (file)
@@ -31,7 +31,7 @@ Mime-Version: 1.0
 Content-Type: text/plain; charset=%s
 Content-Transfer-Encoding: %s
 
-test
+dGVzdA==
 To: example@example.com
 Subject: =?HZ-GB-2312?B?fnsyYlFpfn0gU2ltcGxpZmllZCBD?=
  =?HZ-GB-2312?B?aGluZXNl?=
index b8dafe58ccc2ee834ad3535693eaf5a2e393331e..e92bfd1c9e0f8ad0da54db6112bf0e5cda2724f6 100644 (file)
@@ -31,7 +31,7 @@ Mime-Version: 1.0
 Content-Type: text/plain; charset=%s
 Content-Transfer-Encoding: %s
 
-test
+dGVzdA==
 To: example@example.com
 Subject: =?BIG5?B?tPrF5yBUcmFkaXRpb25hbCBDaGluZXNl?=
 Mime-Version: 1.0