diff --git a/src/Symfony/Component/Mime/Part/TextPart.php b/src/Symfony/Component/Mime/Part/TextPart.php index 549a5fe1e02fe..bddca0a2b474f 100644 --- a/src/Symfony/Component/Mime/Part/TextPart.php +++ b/src/Symfony/Component/Mime/Part/TextPart.php @@ -218,7 +218,7 @@ private function chooseEncoding(): string public function __sleep(): array { // convert resources to strings for serialization - if (null !== $this->seekable) { + if (null !== $this->seekable || $this->body instanceof File) { $this->body = $this->getBody(); $this->seekable = null; } diff --git a/src/Symfony/Component/Mime/Tests/EmailTest.php b/src/Symfony/Component/Mime/Tests/EmailTest.php index f5ffbb7638429..8dba651ffb882 100644 --- a/src/Symfony/Component/Mime/Tests/EmailTest.php +++ b/src/Symfony/Component/Mime/Tests/EmailTest.php @@ -483,6 +483,7 @@ public function testSerialize() $name = __DIR__.'/Fixtures/mimetypes/test'; $file = fopen($name, 'r'); $e->addPart(new DataPart($file, 'test')); + $e->attachFromPath($name, 'same_test'); $expected = clone $e; $n = unserialize(serialize($e)); $this->assertEquals($expected->getHeaders(), $n->getHeaders());
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: