|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54298 Using empty additional_headers adding extraneous CRLF
Submitted: 2011-03-17 18:28 UTC Modified: -
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: anrdaemon at freemail dot ru Assigned:
Status: Open Package: Mail related
PHP Version: Irrelevant OS: Win32/*NIX32
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: anrdaemon at freemail dot ru
New email:
PHP Version: OS:


 [2011-03-17 18:28 UTC] anrdaemon at freemail dot ru
Using the code sample below, you could see that it adds a "\r\n" to the end of the mail headers irrelevant to $additional_headers containing a meaningful value.
Even using an
empty($addParams) ? NULL/false : implode()
replacement, it does not fix the problem. The resulting message will still start from second line. Which is bad for look.
To beat it, you're forced to check for empty($addParams) before invoking mail() (and to have two separate mail() lines in your code, which does not lead to the code clarity)...

Test script:

$addParams = array();
mail('', 'testsubj', 'Body part', implode("\r\n", $addParams));


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Dec 12 11:01:25 2019 UTC