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

From: Date: Thu, 17 Jun 2021 20:13:02 +0000
Subject: Bug #81158 [NEW]: Mails sent by mail function broken since PHP 8.0
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-234464@lists.php.net to get a copy of this message
From:             php at shyim dot de
Operating system: Debian 10 (Docker)
PHP version:      8.0.7
Package:          Mail related
Bug Type:         Bug
Bug description:Mails sent by mail function broken since PHP 8.0

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 bug report at https://bugs.php.net/bug.php?id=81158&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=81158&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=81158&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=81158&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=81158&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=81158&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=81158&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=81158&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=81158&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=81158&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=81158&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81158&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=81158&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=81158&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=81158&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=81158&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=81158&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=81158&r=mysqlcfg


Thread (4 messages)

« previous php.bugs (#234464) next »