Merge pull request #5202 from ndm2/email-zero-only-lines-fix

Prevent zero only lines from being emptied
This commit is contained in:
Mark Story 2014-11-18 12:50:44 -05:00
commit 30f8073537
2 changed files with 20 additions and 1 deletions

View file

@ -1359,7 +1359,7 @@ class CakeEmail {
$cut = ($wrapLength == CakeEmail::LINE_LENGTH_MUST);
foreach ($lines as $line) {
if (empty($line)) {
if (empty($line) && $line !== '0') {
$formatted[] = '';
continue;
}

View file

@ -2416,6 +2416,25 @@ HTML;
$this->assertEquals($expected, $result['message']);
}
/**
* testZeroOnlyLinesNotBeingEmptied()
*
* @return void
*/
public function testZeroOnlyLinesNotBeingEmptied() {
$message = "Lorem\r\n0\r\n0\r\nipsum";
$this->CakeEmail->reset();
$this->CakeEmail->transport('Debug');
$this->CakeEmail->from('cake@cakephp.org');
$this->CakeEmail->to('cake@cakephp.org');
$this->CakeEmail->subject('Wordwrap Test');
$this->CakeEmail->config(array('empty'));
$result = $this->CakeEmail->send($message);
$expected = "{$message}\r\n\r\n";
$this->assertEquals($expected, $result['message']);
}
/**
* CakeEmailTest::assertLineLengths()
*