summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2012-11-23 13:16:20 -0800
committerAndreas Gohr <andi@splitbrain.org>2012-11-23 13:16:20 -0800
commitebd33fd4cb7edee2265314b774f59cdf24826086 (patch)
tree01889658db289d00609170881cfbd9a6bb665c57
parent78f0e83246184ff6cb8679d086b0fa17ab508057 (diff)
parent91effd8de07e4afc59b6763ac72b268f58cfc941 (diff)
downloadrpg-ebd33fd4cb7edee2265314b774f59cdf24826086.tar.gz
rpg-ebd33fd4cb7edee2265314b774f59cdf24826086.tar.bz2
Merge pull request #145 from dom-mel/mailer
Ignore empty email headers
-rw-r--r--_test/tests/inc/mailer.test.php20
-rw-r--r--inc/Mailer.class.php1
2 files changed, 21 insertions, 0 deletions
diff --git a/_test/tests/inc/mailer.test.php b/_test/tests/inc/mailer.test.php
index b2c74a257..053e216b8 100644
--- a/_test/tests/inc/mailer.test.php
+++ b/_test/tests/inc/mailer.test.php
@@ -7,6 +7,14 @@ class TestMailer extends Mailer {
public function prop($name){
return $this->$name;
}
+
+ public function &propRef($name) {
+ return $this->$name;
+ }
+
+ public function prepareHeaders() {
+ return parent::prepareHeaders();
+ }
}
class mailer_test extends DokuWikiTest {
@@ -90,5 +98,17 @@ class mailer_test extends DokuWikiTest {
}
}
+ /**
+ * @see https://forum.dokuwiki.org/post/35822
+ */
+ function test_emptyBCCorCC() {
+ $mail = new TestMailer();
+ $headers = &$mail->propRef('headers');
+ $headers['Bcc'] = '';
+ $headers['Cc'] = '';
+ $header = $mail->prepareHeaders();
+ $this->assertEquals(0, preg_match('/(^|\n)Bcc: (\n|$)/', $header), 'Bcc found in headers.');
+ $this->assertEquals(0, preg_match('/(^|\n)Cc: (\n|$)/', $header), 'Bcc found in headers.');
+ }
}
//Setup VIM: ex: et ts=4 :
diff --git a/inc/Mailer.class.php b/inc/Mailer.class.php
index cbd1eb0a9..f1492be9b 100644
--- a/inc/Mailer.class.php
+++ b/inc/Mailer.class.php
@@ -555,6 +555,7 @@ class Mailer {
protected function prepareHeaders() {
$headers = '';
foreach($this->headers as $key => $val) {
+ if ($val === '') continue;
$headers .= "$key: $val".MAILHEADER_EOL;
}
return $headers;