Skip to content

Commit ae0d489

Browse files
Merge branch '7.4' into 8.0
* 7.4: [TypeInfo] Simple array should be array type Handle signals on text input [TwigBridge] Fix form constraint [Runtime] Reuse the already created Request object when the app needs it as argument returns a kernel [Config] Fix array shape generation for backed enums [Config] Define `TreeBuilder` default generic type Update validators.el.xlf Fix MoneyType: add missing step attribute when html5=true [JsonStreamer] fix invalid json output for list of self [Console] Preserve `--help` option when a command is not found [FrameworkBundle] Fix using `FailedMessages*Command` with `SigningSerializer` [Lock] Fix unserializing already serialized Key payloads [HttpClient] CachingHttpClient must run after UriTemplate and Scoping Only register PhpConfigReferenceDumpPass in dev env with debug flag enabled [Messenger] Fix PHP 8.5 deprecation for pgsqlGetNotify() in PostgreSQL transport chore: PHP CS Fixer - do not use deprecated sets in config verify spanish translations with state needs-review-translation [Security] Fix OIDC discovery when using multiple HttpClient instances [DependencyInjection] Allow manual bindings on parameters with #[Target]
2 parents b3c6df5 + 8ba5de8 commit ae0d489

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

Key.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*
1919
* @author Jérémy Derussé <jeremy@derusse.com>
2020
*/
21-
final class Key
21+
final class Key implements \Stringable
2222
{
2323
private ?float $expiringTime = null;
2424
private array $state = [];
@@ -91,9 +91,9 @@ public function isExpired(): bool
9191

9292
public function __unserialize(array $data): void
9393
{
94-
$this->resource = $data['resource'];
95-
$this->expiringTime = $data['expiringTime'];
96-
$this->state = $data['state'];
94+
$this->resource = $data['resource'] ?? $data["\0".self::class."\0resource"];
95+
$this->expiringTime = $data['expiringTime'] ?? $data["\0".self::class."\0expiringTime"] ?? null;
96+
$this->state = $data['state'] ?? $data["\0".self::class."\0state"] ?? [];
9797
}
9898

9999
public function __serialize(): array

Tests/KeyTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,17 @@ public function testSerialize()
3131
$this->assertEqualsWithDelta($key->getRemainingLifetime(), $copy->getRemainingLifetime(), 0.001);
3232
}
3333

34+
public function testLegacyPayloadCanBeUnserialized()
35+
{
36+
$serialized = base64_decode('TzoyNjoiU3ltZm9ueVxDb21wb25lbnRcTG9ja1xLZXkiOjM6e3M6MzY6IgBTeW1mb255XENvbXBvbmVudFxMb2NrXEtleQByZXNvdXJjZSI7czo2OiJsZWdhY3kiO3M6NDA6IgBTeW1mb255XENvbXBvbmVudFxMb2NrXEtleQBleHBpcmluZ1RpbWUiO047czozMzoiAFN5bWZvbnlcQ29tcG9uZW50XExvY2tcS2V5AHN0YXRlIjthOjA6e319', true);
37+
38+
$key = unserialize($serialized, ['allowed_classes' => [Key::class]]);
39+
40+
$this->assertInstanceOf(Key::class, $key);
41+
$this->assertSame('legacy', (string) $key);
42+
$this->assertNull($key->getRemainingLifetime());
43+
}
44+
3445
public function testUnserialize()
3546
{
3647
$key = new Key(__METHOD__);

0 commit comments

Comments
 (0)