Skip to content
Permalink
Browse files

Prevent zero only lines from being emptied

  • Loading branch information...
ndm2
ndm2 committed Nov 18, 2014
1 parent ddc3eee commit bae556e73fc18fbf081eba7862fb3767be1a5e2a
Showing with 20 additions and 1 deletion.
  1. +1 −1 lib/Cake/Network/Email/CakeEmail.php
  2. +19 −0 lib/Cake/Test/Case/Network/Email/CakeEmailTest.php
@@ -1359,7 +1359,7 @@ protected function _wrap($message, $wrapLength = CakeEmail::LINE_LENGTH_MUST) {
$cut = ($wrapLength == CakeEmail::LINE_LENGTH_MUST);
foreach ($lines as $line) {
if (empty($line)) {
if (empty($line) && $line !== '0') {
$formatted[] = '';
continue;
}
@@ -2416,6 +2416,25 @@ public function testWrapForJapaneseEncoding() {
$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()
*

0 comments on commit bae556e

Please sign in to comment.
You can’t perform that action at this time.