is the last char). (Islam Israfilov)
. Fixed bug #75902 (str_replace should warn when misused with nested arrays).
(Nikita)
+ . Fixed bug #47983 (mixed LF and CRLF line endings in mail()). (cmb)
. Made quoting of cmd execution functions consistent. (cmb)
- tidy:
f = php_basename(tmp, strlen(tmp), NULL, 0);
if (headers != NULL && *headers) {
- spprintf(&hdr, 0, "X-PHP-Originating-Script: " ZEND_LONG_FMT ":%s\n%s", php_getuid(), ZSTR_VAL(f), headers);
+ spprintf(&hdr, 0, "X-PHP-Originating-Script: " ZEND_LONG_FMT ":%s\r\n%s", php_getuid(), ZSTR_VAL(f), headers);
} else {
spprintf(&hdr, 0, "X-PHP-Originating-Script: " ZEND_LONG_FMT ":%s", php_getuid(), ZSTR_VAL(f));
}
MAIL_RET(0);
}
#endif
- fprintf(sendmail, "To: %s\n", to);
- fprintf(sendmail, "Subject: %s\n", subject);
+ fprintf(sendmail, "To: %s\r\n", to);
+ fprintf(sendmail, "Subject: %s\r\n", subject);
if (hdr != NULL) {
- fprintf(sendmail, "%s\n", hdr);
+ fprintf(sendmail, "%s\r\n", hdr);
}
- fprintf(sendmail, "\n%s\n", message);
+ fprintf(sendmail, "\r\n%s\r\n", message);
ret = pclose(sendmail);
#if PHP_SIGCHILD
--- /dev/null
+--TEST--
+Bug #47983 (mixed LF and CRLF line endings in mail())
+--INI--
+sendmail_path={MAIL:bug47983.out}
+--FILE--
+<?php
+var_dump(mail('user@example.com', 'Test Subject', 'A Message', 'KHeaders'));
+$mail = file_get_contents('bug47983.out');
+var_dump(preg_match_all('/(?<!\r)\n/', $mail));
+?>
+--CLEAN--
+<?php
+unlink('bug47983.out');
+?>
+--EXPECT--
+bool(true)
+int(0)