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:
+1
-1
@@ -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;
|
||||
|
||||
@@ -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');
|
||||
?>
|
||||
Reference in New Issue
Block a user