-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
\Expose\Converter\Short: Support UUID v7 #15
Comments
Yeah I dont know what the issue is, but I documented it for now. See PR. |
It seems UUID7 is in general not working properly? https://github.com/dereuromark/cakephp-expose/actions/runs/6038051495/job/16383565370?pr=16 |
The issue is that the strings are shifted '018a4bd3-0218-727e-ad08-33ac76dd1593' <-uuidOrginal uuidOrginal has leading zero |
Look at those two strings without dashes:
if you ignore the hyphens and those two zeros then both strings are identical |
I documented the issue now, see merged PR, I will keep this open for now, maybe someone has an idea for support. |
I don't think this has anything to do with v7 but with leading zeros. |
Yeah, but it is weird that both converters have this issue, not aware of this problem |
At least in the tests, how did u make Keiko work? |
You are just testing wrong converter in your test
|
Copy and paste^^ thx, will fix laters |
As i expected source of problem are leading zeros $uuidOrginal = '00000000-1111-2222-3333-444444444444';
$uuidShort = \Expose\Converter\ConverterFactory::getConverter()->encode($uuidOrginal);
$uuidDecoded = \Expose\Converter\ConverterFactory::getConverter()->decode($uuidShort);
debug($uuidDecoded);
// \Expose\Converter\Short outputs: 11112222-3333-4444-4444-444400000000 I think this happens because you are converting hex string to hex number and converting numeric string to number always drops leading zeroes (base 16 does not matter). So you are going from |
Another example: $uuidOrginal = '00000000-0000-0000-0000-00000000000F';
$uuidShort = \Expose\Converter\ConverterFactory::getConverter()->encode($uuidOrginal);
$uuidDecoded = \Expose\Converter\ConverterFactory::getConverter()->decode($uuidShort);
debug($uuidDecoded);
// \Expose\Converter\Short outputs: f0000000-0000-0000-0000-000000000000 In this example |
Do u have an idea for a fix? Currently traveling for vacation |
Sorry i currently do not have any free cycles for this |
OK, I documented for now to use KeikoShort in this case. I will leave this ticket open in case anyone wants to implement a minimal solution/fix for it. |
Here is test code:
debug is returning
false
when default\Expose\Converter\Short
is usedChanging to
\Expose\Converter\KeikoShort
by adding line below makes debug returnstrue
as expectedThe text was updated successfully, but these errors were encountered: