php.net |  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: -
Votes:1
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: anrdaemon at freemail dot ru
New email:
PHP Version: OS:

 

 [2011-03-17 18:28 UTC] anrdaemon at freemail dot ru
Description:
------------
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:
---------------
<?php

$addParams = array();
mail('someuser@example.com', 'testsubj', 'Body part', implode("\r\n", $addParams));


Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Tue Sep 25 21:01:25 2018 UTC