From 0f7182213a65bcdfc34a7caf976cc45c62a10b23 Mon Sep 17 00:00:00 2001 From: Lito Date: Mon, 11 Apr 2016 15:28:11 +0200 Subject: [PATCH 1/2] Use $exception default value if not set on construct. (#682) --- class.phpmailer.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/class.phpmailer.php b/class.phpmailer.php index a0dae314..1c157474 100644 --- a/class.phpmailer.php +++ b/class.phpmailer.php @@ -635,9 +635,11 @@ class PHPMailer * Constructor. * @param boolean $exceptions Should we throw external exceptions? */ - public function __construct($exceptions = false) + public function __construct($exceptions = null) { - $this->exceptions = (boolean)$exceptions; + if ($exceptions !== null) { + $this->exceptions = (boolean)$exceptions; + } } /** From fb82f2b9ead20343336f1d3a9a03a9183262ff63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Svoboda?= Date: Sun, 17 Apr 2016 09:49:12 +0200 Subject: [PATCH 2/2] Add unit test that shows how address parser returns its result --- test/phpmailerTest.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/phpmailerTest.php b/test/phpmailerTest.php index 7466eee0..e41a0d61 100644 --- a/test/phpmailerTest.php +++ b/test/phpmailerTest.php @@ -1417,6 +1417,19 @@ EOT; ), 'Failed to recognise address list (IMAP parser)' ); + $this->assertEquals( + array( + array("name" => 'Joe User', 'address' => 'joe@example.com'), + array("name" => 'Jill User', 'address' => 'jill@example.net'), + array("name" => '', 'address' => 'frank@example.com'), + ), + $this->Mail->parseAddresses( + 'Joe User ,' + . 'Jill User ,' + . 'frank@example.com,' + ), + 'Parsed addresses' + ); //Test simple address parser $this->assertCount( 2,