Skip to content

Commit 5a0b963

Browse files
Merge branch '5.4' into 6.0
* 5.4: [Messenger] Use :memory: for SQLite tests [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 search scope when performing fallback mapping driver detection Fix the notification email theme for asynchronously dispatched emails Update the CI setup to use the new output file 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 5.4.16 Update VERSION for 5.4.15 Update CHANGELOG for 5.4.15 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 [DependencyInjection] Don't autoconfigure tag when it's already set with attributes
2 parents dd131ba + 227d503 commit 5a0b963

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
@@ -229,15 +229,20 @@ private function getExceptionAsString(\Throwable|FlattenException $exception): s
229229
*/
230230
public function __serialize(): array
231231
{
232-
return [$this->context, parent::__serialize()];
232+
return [$this->context, $this->theme, parent::__serialize()];
233233
}
234234

235235
/**
236236
* @internal
237237
*/
238238
public function __unserialize(array $data): void
239239
{
240-
[$this->context, $parentData] = $data;
240+
if (3 === \count($data)) {
241+
[$this->context, $this->theme, $parentData] = $data;
242+
} else {
243+
// Backwards compatibility for deserializing data structures that were serialized without the theme
244+
[$this->context, $parentData] = $data;
245+
}
241246

242247
parent::__unserialize($parentData);
243248
}

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)