1
0
mirror of https://github.com/php/php-src.git synced 2026-04-29 19:23:22 +02:00

Merge branch 'PHP-7.4'

* PHP-7.4:
  Fix #54298: Using empty additional_headers adding extraneous CRLF
This commit is contained in:
Christoph M. Becker
2020-01-06 14:51:14 +01:00
2 changed files with 25 additions and 1 deletions
+1 -1
View File
@@ -333,7 +333,7 @@ PHP_FUNCTION(mail)
extra_cmd = php_escape_shell_cmd(ZSTR_VAL(extra_cmd));
}
if (php_mail(to_r, subject_r, message, headers_str ? ZSTR_VAL(headers_str) : NULL, extra_cmd ? ZSTR_VAL(extra_cmd) : NULL)) {
if (php_mail(to_r, subject_r, message, headers_str && ZSTR_LEN(headers_str) ? ZSTR_VAL(headers_str) : NULL, extra_cmd ? ZSTR_VAL(extra_cmd) : NULL)) {
RETVAL_TRUE;
} else {
RETVAL_FALSE;
+24
View File
@@ -0,0 +1,24 @@
--TEST--
Bug #54298 (Using empty additional_headers adding extraneous CRLF)
--INI--
sendmail_path=tee bug54298.eml >/dev/null
mail.add_x_header = Off
--SKIPIF--
<?php
if (PHP_OS_FAMILY === 'Windows') die("skip Won't run on Windows");
?>
--FILE--
<?php
var_dump(mail('someuser@example.com', 'testsubj', 'Body part', ''));
echo file_get_contents('bug54298.eml');
?>
--EXPECT--
bool(true)
To: someuser@example.com
Subject: testsubj
Body part
--CLEAN--
<?php
unlink('bug54298.eml');
?>