-
-
Notifications
You must be signed in to change notification settings - Fork 220
Description
Version: 2.10.8 (and many before)
Bug Description
Php manual says that input to mail function "must obey" RFC2822
https://www.php.net/manual/en/function.mail.php
http://www.faqs.org/rfcs/rfc2822.html
There is stated in this RFC that:
2.2. Header Fields
Header fields are lines composed of a field name, followed by a colon
(":"), followed by a field body, and terminated by CRLF.
Tracy in its defaultMailer replaces everything to just LF.
tracy/src/Tracy/Logger/Logger.php
Lines 172 to 174 in 5906211
$parts = str_replace( | |
["\r\n", "\n"], | |
["\n", PHP_EOL], |
Currently, it has caused some trouble on PHP 8.1.24 - emails are not received as the mail server detects multiple 'from' addresses in one mail header because it can't properly split headers by '\n'. I admit I have not really tested what specifically causes the bug - whether it's some configuration, this particular PHP version, or something else (we tested that PHP 8.2 and 8.3 do not cause this issue). However, I have verified that CRLF works correctly. Since it is described as a 'must obey' rule, I am reporting this as a bug. I can also PR it if we have no reason to persist with LF endings. Opinions?
Steps To Reproduce
Not needed imo and hard to do so, based on server config / php version.
Expected Behavior
obey the rfc
Possible Solution
alter line endings during replacements in defaultMailer function