Bug #48201 [Opn->Ver]: wrong behaviour of imap_mail_compose()

From: Date: Mon, 12 Oct 2020 14:06:32 +0000
Subject: Bug #48201 [Opn->Ver]: wrong behaviour of imap_mail_compose()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-229577@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=48201&edit=1 ID: 48201 Updated by: cmb@php.net Reported by: carsten_sttgt at gmx dot de -Summary: wrong behaviour and crash with imap_mail_compose() +Summary: wrong behaviour of imap_mail_compose() -Status: Open +Status: Verified Type: Bug Package: IMAP related Operating System: * -PHP Version: 5.*, 6CVS (2009-05-09) +PHP Version: 7.3 Block user comment: N Private report: N New Comment: > I guess it's more that PHP is just using > rfc822_encode_body_7bit() to the whole message (topbod is > including all bodies from each message part), instead of process > each body part separately, according to the encoding which is set. I think you're right, but I wouldn't change that long-standing (mis-)behavior in stable versions. Some code may easily rely on this. Maybe a bit late for PHP 8.0, but there shouldn't be a problem to fix it for PHP 8.1. > At the moment you have a crash with a wrong "encoding" and also > with a wrong "type". This happens because an access to a not > existent / initialized array key. Indeed; I have filed that recently as bug #80216, so this part of this ticket will be fixed soon. Previous Comments: ------------------------------------------------------------------------ [2009-05-14 07:14:43] carsten_sttgt at gmx dot de Hi Jani, first I must correct my description. Curious I have not seen this, because in "Actual result" you see what happens. >> - 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 must be: - with ENCBASE64, the Content-Transfer-Encoding is "base64" and no transforming is done. - with ENCQUOTEDPRINTABLE, the Content-Transfer-Encoding is "quoted-printable" and no transforming is done. In summary we can say, the current behavior is: - ENC7BIT: no header, no data encoding - ENC8BIT: header switch to ENCQUOTEDPRINTABLE and data is automatically encoded with "quoted-printable" - ENCBINARY: header switch to ENCBASE64 and data is automatically encoded with "base64" - ENCQUOTEDPRINTABLE: header set to ENCQUOTEDPRINTABLE and no data encoding. You must do the encoding yourself - ENCBASE64: header set to ENCBASE64 and no data encoding. You must do the encoding yourself - And I'm not be able, to use a real ENC8BIT/ENCBINARY as header and without this automatically data encoding. - And there is also no info in the manual about the current behavior of this function. (also the list of available body params is not complete in the manual) >> - with "8bit" (or "7bit"), I have a segmentation fault >> (PHP crashes). At the moment you have a crash with a wrong "encoding" and also with a wrong "type". This happens because an access to a not existent / initialized array key. > Patches are welcome. :) Well, to fix this possible crash is easy. Only I'm not sure, how to handle this problem. At the moment I'm printing a "Warning" and the function returns with "false". But it's also possible, to set the value in these cases to "x-unknown" and maybe print an additional "Notice". To allow a real ENC8BIT, ENCBINARY, looks like a "little" bit more work... Regards, Carsten ------------------------------------------------------------------------ [2009-05-11 09:55:58] jani@php.net Patches are welcome. :) ------------------------------------------------------------------------ [2009-05-11 07:21:31] carsten_sttgt at gmx dot de > This bug might be actually bug in c-client though.. I guess it's more that PHP is just using rfc822_encode_body_7bit() to the whole message (topbod is including all bodies from each message part), instead of process each body part separately, according to the encoding which is set. rfc822_encode_body_7bit is forcing a 7bit transfer, and so ENC8BIT must switch to "quoted-printable". ------------------------------------------------------------------------ [2009-05-10 16:40:02] jani@php.net This bug might be actually bug in c-client though.. ------------------------------------------------------------------------ [2009-05-10 16:39:46] jani@php.net Thanks for that. Just want to get the version info right. Just FYI, whenever you know that a bug exists in certain branch, please update the version also. And HEAD is not that necessary at the moment, we can be quite sure it exists there if it exists in PHP_5_3. :) I updated the versions now. Please do same in other reports from now on. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=48201 -- Edit this bug report at https://bugs.php.net/bug.php?id=48201&edit=1

« previous php.bugs (#229577) next »