#48201 [Fbk->Opn]: wrong behaviour and crash with imap_mail_compose()
| From: | carsten_sttgt at gmx dot de | Date: | Sun, 10 May 2009 07:43:01 +0000 |
| Subject: | #48201 [Fbk->Opn]: wrong behaviour and crash with imap_mail_compose() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-137086@lists.php.net to get a copy of this message | ||
ID: 48201
User updated by: carsten_sttgt at gmx dot de
Reported By: carsten_sttgt at gmx dot de
-Status: Feedback
+Status: Open
Bug Type: IMAP related
Operating System: Windows_NT
PHP Version: 5.3CVS-2009-05-09 (snap)
New Comment:
> Please try using this CVS snapshot:
I have test the above with:
Version: 5.3.0RC3-dev Thu, 07 May 2009 13:08:08 +0000
Version: 5.2.10-dev Thu, 07 May 2009 11:42:06 +0100
(the latest binary snapshots which are available for VC6 x86 Thread
Safe)
(and my normal PHP 5.2.9 VC6 x86 Thread Safe)
Can't test with:
Version: 6.0.0-dev Thu, 07 May 2009 11:30:12 +0000
because "php_imap.dll" is missing in the zip.
Previous Comments:
------------------------------------------------------------------------
[2009-05-09 21:07:15] jani@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
------------------------------------------------------------------------
[2009-05-09 11:51:12] carsten_sttgt at gmx dot de
Description:
------------
Hello,
from my understanding, and if I read RFC2045-sec6.2,
imap_mail_compose() is working in a wrong way. From RFC2045:
- With "binary", "8bit" and "7bit" no transforming is done.
- With "quoted-printable" and "base64", the data is transformed
to 7bit, according to the selected encoding type.
The behavior from imap_mail_compose():
- with ENC7BIT no Content-Transfer-Encoding header is set
(ok, that's the same. maybe correct)
- with ENC8BIT, the Content-Transfer-Encoding changes to
"quoted-printable" and the data is transfomed (wrong)
- with ENCBINARY, the Content-Transfer-Encoding changes to
"base64" and the data is transfomed (wrong)
- with ENCBASE64, the Content-Transfer-Encoding is "base64"
and the data is transfomed (correct)
- with ENCQUOTEDPRINTABLE, the Content-Transfer-Encoding is
"quoted-printable" and the data is transfomed (correct)
- ENCOTHER is imho not really useful (especially if I can't
set the name (foo) in x-foo).
Then I've tried to set the value for the Content-Transfer-Encoding
header on my own:
- with "binary", no Content-Transfer-Encoding header is set
- with "8bit" (or "7bit"), I have a segmentation fault (PHP crashes).
Regards,
Carsten
Reproduce code:
---------------
<?php
$data8bit = 'a german umlaut ä.';
$data7bit = 'just a text in us-ascii.';
$body = array();
$i = 0;
$body[++$i] = array(
'type' => TYPEMULTIPART,
'subtype' => 'mixed'
);
$body[++$i] = array(
'type' => TYPETEXT,
'charset' => 'us-ascii',
'encoding' => ENC7BIT,
'contents.data' => $data7bit
);
$body[++$i] = array(
'type' => TYPETEXT,
'charset' => 'iso-8859-1',
'encoding' => ENC8BIT,
'contents.data' => $data8bit
);
$body[++$i] = array(
'type' => TYPETEXT,
'charset' => 'iso-8859-1',
'encoding' => ENCBINARY,
'contents.data' => $data8bit
);
$body[++$i] = array(
'type' => TYPETEXT,
'charset' => 'iso-8859-1',
'encoding' => ENCBASE64,
'contents.data' => $data8bit
);
$body[++$i] = array(
'type' => TYPETEXT,
'charset' => 'iso-8859-1',
'encoding' => ENCQUOTEDPRINTABLE ,
'contents.data' => $data8bit
);
$body[++$i] = array(
'type' => TYPETEXT,
'charset' => 'iso-8859-1',
'encoding' => 'binary',
'contents.data' => $data8bit
);
//$body[++$i] = array(
// 'type' => TYPETEXT,
// 'charset' => 'iso-8859-1',
// 'encoding' => '8bit' ,
// 'contents.data' => $data8bit
//);
echo imap_mail_compose(array(), $body);
?>
Expected result:
----------------
MIME-Version: 1.0
Content-Type: MULTIPART/mixed; BOUNDARY="62-22384-1241869364=:9856"
--62-22384-1241869364=:9856
Content-Type: TEXT/PLAIN; CHARSET=us-ascii
Content-Transfer-Encoding: 7BIT
just a text in us-ascii.
--62-22384-1241869364=:9856
Content-Type: TEXT/PLAIN; CHARSET=iso-8859-1
Content-Transfer-Encoding: 8BIT
a german umlaut ä.
--62-22384-1241869364=:9856
Content-Type: TEXT/PLAIN; CHARSET=iso-8859-1
Content-Transfer-Encoding: BINARY
a german umlaut ä.
--62-22384-1241869364=:9856
Content-Type: TEXT/PLAIN; CHARSET=iso-8859-1
Content-Transfer-Encoding: BASE64
YSBnZXJtYW4gdW1sYXV0IOQu
--62-22384-1241869364=:9856
Content-Type: TEXT/PLAIN; CHARSET=iso-8859-1
Content-Transfer-Encoding: QUOTED-PRINTABLE
a german umlaut =E4.
--62-22384-1241869364=:9856
Content-Type: TEXT/PLAIN; CHARSET=iso-8859-1
Content-Transfer-Encoding: binary
a german umlaut ä.
--62-22384-1241869364=:9856--
Actual result:
--------------
MIME-Version: 1.0
Content-Type: MULTIPART/mixed; BOUNDARY="62-22384-1241869364=:9856"
--62-22384-1241869364=:9856
Content-Type: TEXT/PLAIN; CHARSET=us-ascii
just a text in us-ascii.
--62-22384-1241869364=:9856
Content-Type: TEXT/PLAIN; CHARSET=iso-8859-1
Content-Transfer-Encoding: QUOTED-PRINTABLE
a german umlaut =E4.
--62-22384-1241869364=:9856
Content-Type: TEXT/PLAIN; CHARSET=iso-8859-1
Content-Transfer-Encoding: BASE64
YSBnZXJtYW4gdW1sYXV0IOQu
--62-22384-1241869364=:9856
Content-Type: TEXT/PLAIN; CHARSET=iso-8859-1
Content-Transfer-Encoding: BASE64
a german umlaut ä.
--62-22384-1241869364=:9856
Content-Type: TEXT/PLAIN; CHARSET=iso-8859-1
Content-Transfer-Encoding: QUOTED-PRINTABLE
a german umlaut ä.
--62-22384-1241869364=:9856
Content-Type: TEXT/PLAIN; CHARSET=iso-8859-1
a german umlaut ä.
--62-22384-1241869364=:9856--
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48201&edit=1