Skip to content

Commit 227d503

Browse files
Merge branch '4.4' into 5.4
* 4.4: [Mailer] Stream timeout not detected due to checking only string result of function fgets don not set http_version instead of setting it to null [DependencyInjection] don't move locator tag for service subscriber Fix the notification email theme for asynchronously dispatched emails Update actions in the CI to move away from the deprecated runtime Use 6.3 for new features [HttpFoundation] Check IPv6 is valid before comparing it Run tests with UTC to avoid daylight saving time messing with assertions Bump Symfony version to 4.4.49 Update VERSION for 4.4.48 Update CONTRIBUTORS for 4.4.48 Update CHANGELOG for 4.4.48
2 parents 60db1cc + d6b0fbf commit 227d503

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Mime/NotificationEmail.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,20 @@ private function getExceptionAsString($exception): string
235235
*/
236236
public function __serialize(): array
237237
{
238-
return [$this->context, parent::__serialize()];
238+
return [$this->context, $this->theme, parent::__serialize()];
239239
}
240240

241241
/**
242242
* @internal
243243
*/
244244
public function __unserialize(array $data): void
245245
{
246-
[$this->context, $parentData] = $data;
246+
if (3 === \count($data)) {
247+
[$this->context, $this->theme, $parentData] = $data;
248+
} else {
249+
// Backwards compatibility for deserializing data structures that were serialized without the theme
250+
[$this->context, $parentData] = $data;
251+
}
247252

248253
parent::__unserialize($parentData);
249254
}

Tests/Mime/NotificationEmailTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public function testSerialize()
4747
->importance(NotificationEmail::IMPORTANCE_HIGH)
4848
->action('Bar', 'http://example.com/')
4949
->context(['a' => 'b'])
50+
->theme('example')
5051
));
5152
$this->assertEquals([
5253
'importance' => NotificationEmail::IMPORTANCE_HIGH,
@@ -59,6 +60,8 @@ public function testSerialize()
5960
'a' => 'b',
6061
'footer_text' => 'Notification e-mail sent by Symfony',
6162
], $email->getContext());
63+
64+
$this->assertSame('@email/example/notification/body.html.twig', $email->getHtmlTemplate());
6265
}
6366

6467
public function testTheme()

0 commit comments

Comments
 (0)