Closed bahadirbirsoz closed 2 years ago
I cannot reproduce the problem. Which PHP version do you use? Do you use the uuid extension or the polyfill? Do you have the problem with other uuid versions?
I cannot reproduce the problem. Which PHP version do you use? Do you use the uuid extension or the polyfill? Do you have the problem with other uuid versions?
Hello. I'm using PHP version 8.1.1 with Uuuid extension. I've just checkout uid 6.1 and reproduced it. I've also reproduced it with php 8.0 and polyfill as well.
I can reproduce the error with php 8.1 in OSX but it seems that the problem is in extension. Try to generate uuid with the extension and check the result
// php uid.php
<?php
echo uuid_create(); // "D3151AC6-C9D9-4CD5-9C6C-DB2F2B999542"
Maybe you can open a issue in pecl repository https://github.com/php/pecl-networking-uuid
Yes, I can confirm that problem is in the extension. uuid_create
with extension generates all uppercase string representation of uuid.
php > $uuid = \Symfony\Polyfill\Uuid\Uuid::uuid_create(1);
php > echo $uuid;
cb455324-783e-11ec-9197-cd5b40bb2813
Symfony polyfill creates all lowercase as expected. I have opened an issue on pecl repository.
Symfony version(s) affected
5.4 to 6.1
Description
UuidV6::generate method generates uid string representation with lower and upper cases. It is supposed to use only lower cases. The issue is at UuidV6::generate method.
How to reproduce
composer require symfony/uid
php -a
Possible Solution
In the constructor, on line 30, instead of assigning generated value, parent::__construct can be called, as in the parent constructor, strtolower already exists.
Also, Uuid::V6 static method is already available for generation UuidV6 instance staticly. It is best to make this static::generate method private as it only generates a string representation of a uuid, and should be user internally.
Additional Context
According to RFC 4122
According to https://www.itu.int/rec/T-REC-X.667/en