Prevent zero only lines from being emptied

This commit is contained in:
ndm2 2014-11-18 17:26:31 +01:00
parent ddc3eee84c
commit bae556e73f
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()
*