diff options
author | Tjerk Meesters <datibbaw@php.net> | 2014-02-28 22:30:21 +0800 |
---|---|---|
committer | Tjerk Meesters <datibbaw@php.net> | 2014-02-28 22:30:21 +0800 |
commit | d022c8565da4ec079cd285b245fd28e3f31a3cdb (patch) | |
tree | 981ea7701ed5fbd236a2aa1bb9269280dfa1484b | |
parent | 9443fb999d35abedbd12e7c3340ae756cc1f9298 (diff) | |
parent | eca13f7909a499e0215af1948ad8ff77bd21278e (diff) | |
download | php-git-d022c8565da4ec079cd285b245fd28e3f31a3cdb.tar.gz |
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
Fixed test case title
[bug 66535] X-PHP-Originating-Script adds newline if no custom headers are given
-rw-r--r-- | ext/standard/mail.c | 2 | ||||
-rw-r--r-- | ext/standard/tests/mail/bug66535.phpt | 43 |
2 files changed, 44 insertions, 1 deletions
diff --git a/ext/standard/mail.c b/ext/standard/mail.c index bfbcef6ceb..b877b87420 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -286,7 +286,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..db1f449cb6 --- /dev/null +++ b/ext/standard/tests/mail/bug66535.phpt @@ -0,0 +1,43 @@ +--TEST-- +Bug #66535: Extra newline if add_x_header and no additional headers are used +--INI-- +sendmail_path=tee mailBasic.out >/dev/null +mail.add_x_header = On +--SKIPIF-- +<?php +if(substr(PHP_OS, 0, 3) == "WIN") + die("skip Won't run on Windows"); +?> +--FILE-- +<?php +/* Prototype : int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]]) + * Description: Send an email message + * Source code: ext/standard/mail.c + * Alias to functions: + */ + +echo "*** Testing mail() : send email without additional headers ***\n"; + +// Initialise all required variables +$to = 'user@company.com'; +$subject = 'Test Subject'; +$message = 'A Message'; + +$outFile = "mailBasic.out"; +@unlink($outFile); + +var_dump( mail($to, $subject, $message) ); +echo file_get_contents($outFile); +unlink($outFile); + +?> +===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=== |