com php-src: Fixed Bug #69874 : Can't set empty additional_he aders for mail(): ext/standard/mail.c ext/stand ard/tests/mail/bug69874.phpt
| From: | Stanislav Malyshev | Date: | Fri, 19 Jun 2015 03:19:12 +0000 |
| Subject: | com php-src: Fixed Bug #69874 : Can't set empty additional_he aders for mail(): ext/standard/mail.c ext/stand ard/tests/mail/bug69874.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-87596@lists.php.net to get a copy of this message | ||
Commit: dacea3f6fb3f84c79a3412b24547eb2c636754f6
Author: Yasuo Ohgaki <yohgaki@php.net> Fri, 19 Jun 2015 12:19:02 +0900
Parents: cc7194dd10f9822d882d1cbd259d4208ccc82671
Branches: PHP-5.4 PHP-5.5 PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=dacea3f6fb3f84c79a3412b24547eb2c636754f6
Log:
Fixed Bug #69874 : Can't set empty additional_headers for mail()
Bugs:
https://bugs.php.net/69874
Changed paths:
M ext/standard/mail.c
A ext/standard/tests/mail/bug69874.phpt
Diff:
diff --git a/ext/standard/mail.c b/ext/standard/mail.c
index 448013a..1c1332b 100644
--- a/ext/standard/mail.c
+++ b/ext/standard/mail.c
@@ -320,7 +320,7 @@ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char
efree(f);
}
- if (hdr && php_mail_detect_multiple_crlf(hdr)) {
+ if (hdr && strlen(hdr) && php_mail_detect_multiple_crlf(hdr)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Multiple or malformed newlines found in
additional_header");
MAIL_RET(0);
}
diff --git a/ext/standard/tests/mail/bug69874.phpt b/ext/standard/tests/mail/bug69874.phpt
new file mode 100644
index 0000000..a952a73
--- /dev/null
+++ b/ext/standard/tests/mail/bug69874.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Bug #69874: Null addtional_headers does not send mail
+--INI--
+sendmail_path=tee mailBasic.out >/dev/null
+mail.add_x_header = Off
+--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
+
+A Message
+===DONE===