bug #36463 [Mime] Ensure proper line-ending for SMIME (sstok)
This PR was merged into the 5.0 branch.
Discussion
----------
[Mime] Ensure proper line-ending for SMIME
| Q | A
| ------------- | ---
| Branch? | 5.0
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix #36398
| License | MIT
| Doc PR |
Commits
-------
5e3ccc2814
[Mime] Ensure proper line-ending for SMIME
This commit is contained in:
commit
6f81e03331
@ -65,7 +65,7 @@ abstract class SMime
|
||||
protected function getStreamIterator($stream): iterable
|
||||
{
|
||||
while (!feof($stream)) {
|
||||
yield fread($stream, 16372);
|
||||
yield str_replace("\n", "\r\n", str_replace("\r\n", "\n", fread($stream, 16372)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,11 @@ class SMimeEncryptorTest extends SMimeTestCase
|
||||
private function assertMessageIsEncryptedProperly(Message $message, Message $originalMessage): void
|
||||
{
|
||||
$messageFile = $this->generateTmpFilename();
|
||||
file_put_contents($messageFile, $message->toString());
|
||||
file_put_contents($messageFile, $messageString = $message->toString());
|
||||
|
||||
// Ensure the proper line-ending is used for compatibility with the RFC
|
||||
$this->assertStringContainsString("\n\r", $messageString);
|
||||
$this->assertStringNotContainsString("\n\n", $messageString);
|
||||
|
||||
$outputFile = $this->generateTmpFilename();
|
||||
|
||||
|
Reference in New Issue
Block a user