Skip to content

Commit

Permalink
[Mime] Fix TextPart broken after being serialized
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Sep 1, 2022
1 parent 1864eaa commit a1a1609
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Symfony/Component/Mime/Part/TextPart.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ public function __sleep()
// convert resources to strings for serialization
if (null !== $this->seekable) {
$this->body = $this->getBody();
$this->seekable = null;
}

$this->_headers = $this->getHeaders();
Expand Down
4 changes: 3 additions & 1 deletion src/Symfony/Component/Mime/Tests/Part/TextPartTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ public function testSerialize()
$p = new TextPart($r);
$p->getHeaders()->addTextHeader('foo', 'bar');
$expected = clone $p;
$this->assertEquals($expected->toString(), unserialize(serialize($p))->toString());
$n = unserialize(serialize($p));
$this->assertEquals($expected->toString(), $p->toString());
$this->assertEquals($expected->toString(), $n->toString());
}
}

0 comments on commit a1a1609

Please sign in to comment.