Bug #81158 [Com]: Mails sent by mail function broken since PHP 8.0

From: Date: Thu, 17 Jun 2021 20:15:13 +0000
Subject: Bug #81158 [Com]: Mails sent by mail function broken since PHP 8.0
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-234465@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81158&edit=1

 ID:                 81158
 Comment by:         php at shyim dot de
 Reported by:        php at shyim dot de
 Summary:            Mails sent by mail function broken since PHP 8.0
 Status:             Open
 Type:               Bug
 Package:            Mail related
 Operating System:   Debian 10 (Docker)
 PHP Version:        8.0.7
 Block user comment: N
 Private report:     N

 New Comment:

Here is a screenshot of the sent mail. The headers have always two new lines instead one:
https://i.imgur.com/iQEaUyi.png


Previous Comments:
------------------------------------------------------------------------
[2021-06-17 20:13:02] php at shyim dot de

Description:
------------
Setup:

- Mailhog
- SSMTP
- Configured php.ini to ssmtp -t

Execute the test script with 7.4 and 8.0. The email looks correct in 7.4 and its totally broken on
8.0. The headers are in the body in PHP 8.0.

Test script:
---------------
$to      = 'nobody@example.com';
        $subject = 'the subject';
        $message = 'hello';
        $headers = 'From: webmaster@example.com' . "\r\n" .
            'Reply-To: webmaster@example.com' . "\r\n" .
            'X-Mailer: PHP/' . phpversion();

        mail($to, $subject, $message, $headers);

Taken from https://www.php.net/manual/en/function.mail

Expected result:
----------------
The mail is the same on both PHP versions

Actual result:
--------------
It's totally different. The PHP 8.0 doesn't have a subject. I guess it has something done
with https://github.com/php/php-src/commit/6983ae751cd301886c966b84367fc7aaa1273b2d#diff-c6922cd89f6f75912eb377833ca1eddb7dd41de088be821024b8a0e340fed3df


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=81158&edit=1


Thread (4 messages)

« previous php.bugs (#234465) next »