summaryrefslogtreecommitdiff
path: root/ext/standard/tests
diff options
context:
space:
mode:
authorTjerk Meesters <datibbaw@php.net>2014-02-28 22:22:07 +0800
committerTjerk Meesters <datibbaw@php.net>2014-02-28 22:22:07 +0800
commit79b3c2a744e68c61ccfe36df097bdbdfe6e7ff48 (patch)
treec35d6549559fd33e6899f7b6fccdef298e94d0b2 /ext/standard/tests
parentb1df743b7a9da1b84d5af8dfb430a98022009cd8 (diff)
downloadphp-git-79b3c2a744e68c61ccfe36df097bdbdfe6e7ff48.tar.gz
[bug 66535] X-PHP-Originating-Script adds newline if no custom headers are given
A newline is added to the mail headers when mail.add_x_header is used and no other headers are passed to mail(). The scenario in which custom headers are used was already fixed in #48620, back in 2009.
Diffstat (limited to 'ext/standard/tests')
-rw-r--r--ext/standard/tests/mail/bug66535.phpt43
1 files changed, 43 insertions, 0 deletions
diff --git a/ext/standard/tests/mail/bug66535.phpt b/ext/standard/tests/mail/bug66535.phpt
new file mode 100644
index 0000000000..75e12849a2
--- /dev/null
+++ b/ext/standard/tests/mail/bug66535.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test mail() function : basic functionality
+--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===