From 33408bc882040c739653caafdfd82f4d5ec6164b Mon Sep 17 00:00:00 2001 From: Catalin Dan Date: Tue, 8 Nov 2022 16:53:55 +0200 Subject: [PATCH] [Mime] When serializing File parts convert to string to to allow proper unserialization. Fixes #47991. --- src/Symfony/Component/Mime/Part/TextPart.php | 2 +- src/Symfony/Component/Mime/Tests/EmailTest.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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()); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

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:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy