mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-18 07:29:51 +00:00
Prevent zero only lines from being emptied
This commit is contained in:
parent
ddc3eee84c
commit
bae556e73f
2 changed files with 20 additions and 1 deletions
|
@ -1359,7 +1359,7 @@ class CakeEmail {
|
||||||
$cut = ($wrapLength == CakeEmail::LINE_LENGTH_MUST);
|
$cut = ($wrapLength == CakeEmail::LINE_LENGTH_MUST);
|
||||||
|
|
||||||
foreach ($lines as $line) {
|
foreach ($lines as $line) {
|
||||||
if (empty($line)) {
|
if (empty($line) && $line !== '0') {
|
||||||
$formatted[] = '';
|
$formatted[] = '';
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2416,6 +2416,25 @@ HTML;
|
||||||
$this->assertEquals($expected, $result['message']);
|
$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()
|
* CakeEmailTest::assertLineLengths()
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue