forked from PHPMailer/PHPMailer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/PHPMailer/PHPMailer
- Loading branch information
Showing
2 changed files
with
10 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -997,10 +997,7 @@ public function testHtmlIso8859() | |
realpath($this->INCLUDE_DIR . '/examples') | ||
); | ||
$this->buildBody(); | ||
$this->assertTrue( | ||
strpos($this->Mail->Body, $check) !== false, | ||
'ISO message body does not contain expected text' | ||
); | ||
$this->assertContains($check, $this->Mail->Body, 'ISO message body does not contain expected text'); | ||
$this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); | ||
} | ||
|
||
|
@@ -1121,35 +1118,23 @@ function ($html) { | |
|
||
//Test that local paths without a basedir are ignored | ||
$this->Mail->msgHTML('<img src="/etc/hostname">test'); | ||
$this->assertTrue(strpos($this->Mail->Body, 'src="/etc/hostname"') !== false); | ||
$this->assertContains('src="/etc/hostname"', $this->Mail->Body); | ||
//Test that local paths with a basedir are not ignored | ||
$this->Mail->msgHTML('<img src="composer.json">test', realpath($this->INCLUDE_DIR)); | ||
$this->assertTrue(strpos($this->Mail->Body, 'src="composer.json"') === false); | ||
$this->assertNotContains('src="composer.json"', $this->Mail->Body); | ||
//Test that local paths with parent traversal are ignored | ||
$this->Mail->msgHTML('<img src="../composer.json">test', realpath($this->INCLUDE_DIR)); | ||
$this->assertTrue(strpos($this->Mail->Body, 'src="composer.json"') === false); | ||
$this->assertNotContains('src="composer.json"', $this->Mail->Body); | ||
//Test that existing embedded URLs are ignored | ||
$this->Mail->msgHTML('<img src="cid:5d41402abc4b2a76b9719d911017c592">test'); | ||
$this->assertTrue( | ||
strpos($this->Mail->Body, 'src="cid:5d41402abc4b2a76b9719d911017c592"') !== false | ||
); | ||
$this->assertContains('src="cid:5d41402abc4b2a76b9719d911017c592"', $this->Mail->Body); | ||
//Test that absolute URLs are ignored | ||
$this->Mail->msgHTML('<img src="https://github.com/PHPMailer/PHPMailer/blob/master/composer.json">test'); | ||
$this->assertTrue( | ||
false !== strpos( | ||
$this->Mail->Body, | ||
'src="https://github.com/PHPMailer/PHPMailer/blob/master/composer.json"' | ||
) | ||
); | ||
$this->assertContains('src="https://github.com/PHPMailer/PHPMailer/blob/master/composer.json"', $this->Mail->Body); | ||
//Test that absolute URLs with anonymous/relative protocol are ignored | ||
//Note that such URLs will not work in email anyway because they have no protocol to be relative to | ||
$this->Mail->msgHTML('<img src="//github.com/PHPMailer/PHPMailer/blob/master/composer.json">test'); | ||
$this->assertTrue( | ||
strpos( | ||
$this->Mail->Body, | ||
'src="//github.com/PHPMailer/PHPMailer/blob/master/composer.json"' | ||
) !== false | ||
); | ||
$this->assertContains('src="//github.com/PHPMailer/PHPMailer/blob/master/composer.json"', $this->Mail->Body); | ||
} | ||
|
||
/** | ||
|
@@ -1700,7 +1685,7 @@ public function testAddressEscaping() | |
$this->buildBody(); | ||
$this->Mail->preSend(); | ||
$b = $this->Mail->getSentMIMEMessage(); | ||
$this->assertTrue((false !== strpos($b, 'To: "Tim \"The Book\" O\'Reilly" <[email protected]>'))); | ||
$this->assertContains('To: "Tim \"The Book\" O\'Reilly" <[email protected]>', $b); | ||
|
||
$this->Mail->Subject .= ': Address escaping invalid'; | ||
$this->Mail->clearAddresses(); | ||
|
@@ -1746,7 +1731,7 @@ public function testBCCAddressing() | |
$this->Mail->preSend(); | ||
$b = $this->Mail->getSentMIMEMessage(); | ||
$this->assertTrue($this->Mail->addBCC('[email protected]'), 'BCC addressing failed'); | ||
$this->assertTrue((false !== strpos($b, 'To: Foo <[email protected]>'))); | ||
$this->assertContains('To: Foo <[email protected]>', $b); | ||
$this->assertTrue($this->Mail->send(), 'send failed'); | ||
} | ||
|
||
|