mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge pull request #5202 from ndm2/email-zero-only-lines-fix
Prevent zero only lines from being emptied
This commit is contained in:
commit
30f8073537
2 changed files with 20 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue