8000 [Mime] When serializing File parts convert to string to allow proper unserialization by ovrflo · Pull Request #48156 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Mime] When serializing File parts convert to string to allow proper unserialization #48156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8000
[Mime] When serializing File parts convert to string to to allow prop…
…er unserialization. Fixes #47991.
  • Loading branch information
ovrflo committed Nov 8, 2022
commit 33408bc882040c739653caafdfd82f4d5ec6164b
2 changes: 1 addition & 1 deletion src/Symfony/Component/Mime/Part/TextPart.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/Mime/Tests/EmailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
0