8000 Merge branch '6.1' into 6.2 · symfony/symfony@c7825b7 · GitHub
[go: up one dir, main page]

Skip to content

Commit c7825b7

Browse files
committed
Merge branch '6.1' into 6.2
* 6.1: [Uid] Fix validating nil and max uuid Bump Symfony version to 6.1.11 Update VERSION for 6.1.10 Update CHANGELOG for 6.1.10 Bump Symfony version to 6.0.19 Update VERSION for 6.0.18 Update CHANGELOG for 6.0.18 Bump Symfony version to 5.4.19 Update VERSION for 5.4.18 Update CHANGELOG for 5.4.18
2 parents f882cd6 + 70d9188 commit c7825b7

File tree

4 files changed

+38
-1
lines changed

4 files changed

+38
-1
lines changed

CHANGELOG-6.0.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ in 6.0 minor versions.
77
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
88
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v6.0.0...v6.0.1
99

10+
* 6.0.18 (2022-12-29)
11+
12+
* bug #48823 [Cache] Fix possibly null value passed to preg_match() in RedisTrait (chalasr)
13+
* bug #48816 [Cache] Fix for RedisAdapter without auth parameter (rikvdh)
14+
1015
* 6.0.17 (2022-12-28)
1116

1217
* bug #48787 [PhpUnitBridge] Use verbose deprecation output for quiet types only when it reaches the threshold (ogizanagi)

CHANGELOG-6.1.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ in 6.1 minor versions.
77
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
88
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v6.1.0...v6.1.1
99

10+
* 6.1.10 (2022-12-29)
11+
12+
* bug #48823 [Cache] Fix possibly null value passed to preg_match() in RedisTrait (chalasr)
13+
* bug #48816 [Cache] Fix for RedisAdapter without auth parameter (rikvdh)
14+
1015
* 6.1.9 (2022-12-28)
1116

1217
* bug #48787 [PhpUnitBridge] Use verbose deprecation output for quiet types only when it reaches the threshold (ogizanagi)

src/Symfony/Component/Uid/Tests/UuidTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,25 @@ public function testIsValid()
204204
$this->assertTrue(UuidV4::isValid(self::A_UUID_V4));
205205
}
206206

207+
public function testIsValidWithNilUuid()
208+
{
209+
$this->assertTrue(Uuid::isValid('00000000-0000-0000-0000-000000000000'));
210+
$this->assertTrue(NilUuid::isValid('00000000-0000-0000-0000-000000000000'));
211+
212+
$this->assertFalse(UuidV1::isValid('00000000-0000-0000-0000-000000000000'));
213+
$this->assertFalse(UuidV4::isValid('00000000-0000-0000-0000-000000000000'));
214+
}
215+
216+
public function testIsValidWithMaxUuid()
217+
{
218+
$this->assertTrue(Uuid::isValid('ffffffff-ffff-ffff-ffff-ffffffffffff'));
219+
$this->assertTrue(Uuid::isValid('FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF'));
220+
$this->assertTrue(Uuid::isValid('fFFFFFFF-ffff-FFFF-FFFF-FFFFffFFFFFF'));
221+
222+
$this->assertFalse(UuidV5::isValid('ffffffff-ffff-ffff-ffff-ffffffffffff'));
223+
$this->assertFalse(UuidV6::isValid('ffffffff-ffff-ffff-ffff-ffffffffffff'));
224+
}
225+
207226
public function testEquals()
208227
{
209228
$uuid1 = new UuidV1(self::A_UUID_V1);

src/Symfony/Component/Uid/Uuid.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public static function fromString(string $uuid): static
5656
$uuid = substr_replace($uuid, '-', 18, 0);
5757
$uuid = substr_replace($uuid, '-', 23, 0);
5858
} elseif (26 === \strlen($uuid) && Ulid::isValid($uuid)) {
59-
$ulid = new Ulid('00000000000000000000000000');
59+
$ulid = new NilUlid();
6060
$ulid->uid = strtoupper($uuid);
6161
$uuid = $ulid->toRfc4122();
6262
}
@@ -132,6 +132,14 @@ final public static function v8(string $uuid): UuidV8
132132

133133
public static function isValid(string $uuid): bool
134134
{
135+
if (self::NIL === $uuid && \in_array(static::class, [__CLASS__, NilUuid::class], true)) {
136+
return true;
137+
}
138+
139+
if (__CLASS__ === static::class && 'ffffffff-ffff-ffff-ffff-ffffffffffff' === strtr($uuid, 'F', 'f')) {
140+
return true;
141+
}
142+
135143
if (!preg_match('{^[0-9a-f]{8}(?:-[0-9a-f]{4}){2}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$}Di', $uuid)) {
136144
return false;
137145
}

0 commit comments

Comments
 (0)
0