mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Merge pull request #5954 from cakephp/issue-5948
Check line length to account for fence post.
This commit is contained in:
commit
19f28c419e
3 changed files with 34 additions and 1 deletions
|
@ -1421,7 +1421,7 @@ class CakeEmail {
|
|||
$tmpLine .= $char;
|
||||
$tmpLineLength++;
|
||||
if ($tmpLineLength === $wrapLength) {
|
||||
$nextChar = $line[$i + 1];
|
||||
$nextChar = isset($line[$i + 1]) ? $line[$i + 1] : '';
|
||||
if ($nextChar === ' ' || $nextChar === '<') {
|
||||
$formatted[] = trim($tmpLine);
|
||||
$tmpLine = '';
|
||||
|
|
|
@ -2435,6 +2435,25 @@ HTML;
|
|||
$this->assertEquals($expected, $result['message']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that really long lines don't cause errors.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testReallyLongLine() {
|
||||
$this->CakeEmail->reset();
|
||||
$this->CakeEmail->config(array('empty'));
|
||||
$this->CakeEmail->transport('Debug');
|
||||
$this->CakeEmail->from('cake@cakephp.org');
|
||||
$this->CakeEmail->to('cake@cakephp.org');
|
||||
$this->CakeEmail->subject('Wordwrap Test');
|
||||
$this->CakeEmail->emailFormat('html');
|
||||
$this->CakeEmail->template('long_line', null);
|
||||
$result = $this->CakeEmail->send();
|
||||
$this->assertContains('<a>', $result['message'], 'First bits are included');
|
||||
$this->assertContains('x', $result['message'], 'Last byte are included');
|
||||
}
|
||||
|
||||
/**
|
||||
* CakeEmailTest::assertLineLengths()
|
||||
*
|
||||
|
|
14
lib/Cake/Test/test_app/View/Emails/html/long_line.ctp
Normal file
14
lib/Cake/Test/test_app/View/Emails/html/long_line.ctp
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
echo '<a>34567890123456789012345678901234567890123456789012345678901234567890' .
|
||||
'12345678901234567890123456789012345678901234567890123456789012345678901234567890' .
|
||||
'12345678901234567890123456789012345678901234567890123456789012345678901234567890' .
|
||||
'12345678901234567890123456789012345678901234567890123456789012345678901234567890' .
|
||||
'12345678901234567890123456789012345678901234567890123456789012345678901234567890' .
|
||||
'12345678901234567890123456789012345678901234567890123456789012345678901234567890' .
|
||||
'12345678901234567890123456789012345678901234567890123456789012345678901234567890' .
|
||||
'12345678901234567890123456789012345678901234567890123456789012345678901234567890' .
|
||||
'12345678901234567890123456789012345678901234567890123456789012345678901234567890' .
|
||||
'12345678901234567890123456789012345678901234567890123456789012345678901234567890' .
|
||||
'12345678901234567890123456789012345678901234567890123456789012345678901234567890' .
|
||||
'12345678901234567890123456789012345678901234567890123456789012345678901234567890' .
|
||||
'1234567890123456789012345678901234567890123456x';
|
Loading…
Reference in a new issue