Bug #54298 [NEW]: Using empty additional_headers adding extraneous CRLF

From: Date: Thu, 17 Mar 2011 17:28:09 +0000
Subject: Bug #54298 [NEW]: Using empty additional_headers adding extraneous CRLF
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-159569@lists.php.net to get a copy of this message
From: Operating system: Win32/*NIX32 PHP version: Irrelevant Package: Mail related Bug Type: Bug Bug description:Using empty additional_headers adding extraneous CRLF 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)); -- Edit bug report at http://bugs.php.net/bug.php?id=54298&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54298&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54298&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54298&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=54298&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54298&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=54298&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=54298&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=54298&r=needscript Try newer version: http://bugs.php.net/fix.php?id=54298&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=54298&r=support Expected behavior: http://bugs.php.net/fix.php?id=54298&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=54298&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=54298&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=54298&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54298&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=54298&r=dst IIS Stability: http://bugs.php.net/fix.php?id=54298&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=54298&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=54298&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=54298&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=54298&r=mysqlcfg

« previous php.bugs (#159569) next »