File tree 4 files changed +38
-1
lines changed
Filter options
src/Symfony/Component/Uid 4 files changed +38
-1
lines changed
Original file line number Diff line number Diff line change @@ -7,6 +7,11 @@ in 6.0 minor versions.
7
7
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
8
8
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v6.0.0...v6.0.1
9
9
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
+
10
15
* 6.0.17 (2022-12-28)
11
16
12
17
* bug #48787 [ PhpUnitBridge] Use verbose deprecation output for quiet types only when it reaches the threshold (ogizanagi)
Original file line number Diff line number Diff line change @@ -7,6 +7,11 @@ in 6.1 minor versions.
7
7
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
8
8
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v6.1.0...v6.1.1
9
9
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
+
10
15
* 6.1.9 (2022-12-28)
11
16
12
17
* bug #48787 [ PhpUnitBridge] Use verbose deprecation output for quiet types only when it reaches the threshold (ogizanagi)
Original file line number Diff line number Diff line change @@ -204,6 +204,25 @@ public function testIsValid()
204
204
$ this ->assertTrue (UuidV4::isValid (self ::A_UUID_V4 ));
205
205
}
206
206
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
+
207
226
public function testEquals ()
208
227
{
209
228
$ uuid1 = new UuidV1 (self ::A_UUID_V1 );
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ public static function fromString(string $uuid): static
56
56
$ uuid = substr_replace ($ uuid , '- ' , 18 , 0 );
57
57
$ uuid = substr_replace ($ uuid , '- ' , 23 , 0 );
58
58
} elseif (26 === \strlen ($ uuid ) && Ulid::isValid ($ uuid )) {
59
- $ ulid = new Ulid ( ' 00000000000000000000000000 ' );
59
+ $ ulid = new NilUlid ( );
60
60
$ ulid ->uid = strtoupper ($ uuid );
61
61
$ uuid = $ ulid ->toRfc4122 ();
62
62
}
@@ -132,6 +132,14 @@ final public static function v8(string $uuid): UuidV8
132
132
133
133
public static function isValid (string $ uuid ): bool
134
134
{
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
+
135
143
if (!preg_match ('{^[0-9a-f]{8}(?:-[0-9a-f]{4}){2}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$}Di ' , $ uuid )) {
136
144
return false ;
137
145
}
You can’t perform that action at this time.
0 commit comments