Skip to content

Commit 54641cb

Browse files
committed
bug symfony#57887 [Uid] Ensure UuidV1 is created in lowercase (smnandre)
This PR was submitted for the 7.2 branch but it was merged into the 5.4 branch instead. Discussion ---------- [Uid] Ensure UuidV1 is created in lowercase | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | Fix symfony#57878 | License | MIT Ensure `$this->uid` is in lowercase in UuidV1 (see symfony#57878 for context) (strtolower is already called in the parent::__construct... but not when $args is null. And the uuid extension generates uppercase values --at least sometimes--). Not sure if should be considered a "bug" / which version to flag ? Commits ------- 9abfd25 [Uid] Ensure UuidV1 is created in lowercase
2 parents b0fe332 + 9abfd25 commit 54641cb

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,15 @@ public function testV1()
9090
$this->assertSame('3499710062d0', $uuid->getNode());
9191
}
9292

93+
public function testV1IsLowerCase()
94+
{
95+
$uuid = new UuidV1();
96+
$this->assertSame(strtolower((string) $uuid), (string) $uuid);
97+
98+
$uuid = new UuidV1('D9E7A184-5D5B-11EA-A62A-3499710062D0');
99+
$this->assertSame(strtolower((string) $uuid), (string) $uuid);
100+
}
101+
93102
public function testV3()
94103
{
95104
$uuid = Uuid::v3(new UuidV4(self::A_UUID_V4), 'the name');

src/Symfony/Component/Uid/UuidV1.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class UuidV1 extends Uuid
2525
public function __construct(?string $uuid = null)
2626
{
2727
if (null === $uuid) {
28-
$this->uid = uuid_create(static::TYPE);
28+
$this->uid = strtolower(uuid_create(static::TYPE));
2929
} else {
3030
parent::__construct($uuid, true);
3131
}

0 commit comments

Comments
 (0)