From: Tjerk Meesters Date: Fri, 28 Feb 2014 14:22:07 +0000 (+0800) Subject: [bug 66535] X-PHP-Originating-Script adds newline if no custom headers are given X-Git-Tag: php-5.4.27RC1~20 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=79b3c2a744e68c61ccfe36df097bdbdfe6e7ff48;p=php [bug 66535] X-PHP-Originating-Script adds newline if no custom headers are given A newline is added to the mail headers when mail.add_x_header is used and no other headers are passed to mail(). The scenario in which custom headers are used was already fixed in #48620, back in 2009. --- diff --git a/ext/standard/mail.c b/ext/standard/mail.c index 43adfeef71..1ebc8fecb7 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -276,7 +276,7 @@ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char if (headers != NULL) { spprintf(&hdr, 0, "X-PHP-Originating-Script: %ld:%s\n%s", php_getuid(TSRMLS_C), f, headers); } else { - spprintf(&hdr, 0, "X-PHP-Originating-Script: %ld:%s\n", php_getuid(TSRMLS_C), f); + spprintf(&hdr, 0, "X-PHP-Originating-Script: %ld:%s", php_getuid(TSRMLS_C), f); } efree(f); } diff --git a/ext/standard/tests/mail/bug66535.phpt b/ext/standard/tests/mail/bug66535.phpt new file mode 100644 index 0000000000..75e12849a2 --- /dev/null +++ b/ext/standard/tests/mail/bug66535.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test mail() function : basic functionality +--INI-- +sendmail_path=tee mailBasic.out >/dev/null +mail.add_x_header = On +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing mail() : send email without additional headers *** +bool(true) +To: user@company.com +Subject: Test Subject +X-PHP-Originating-Script: %d:bug66535.php + +A Message +===DONE===