Skip to content
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

Incorrect information in the comment block for the function Str::orderedUuid() #50231

Closed
wq9578 opened this issue Feb 24, 2024 · 1 comment
Closed

Comments

@wq9578
Copy link
Contributor

wq9578 commented Feb 24, 2024

Laravel Version

10.44.0

PHP Version

8.3.1

Database Driver & Version

MySQL 8.2.0

Description

In the comment block for the function Str::orderedUuid() it is incorrectly stated:

Generate a time-ordered UUID (version 4).

Correctly it should be written:

Generate a time-ordered modification of UUID (version 4) containing a time stamp.

By definition

Version 4 UUIDs [...] do not contain any information about the time they are created [...].

While this is not technically a bug breaking execution, this error in the statement (claiming to be version 4) might trap a developer into using this function by believing that the generated UUIDs do not contain any time information, leading to unintended leakage of (time) information.

Strictly speaking, Str::orderedUuid() doesn't produce UUIDs fully complying to RFC 4122, but just the customization "Timestamp-first COMB Codec":

In 2002, Jimmy Nilsson recognized this problem with random UUIDs and proposed a solution he called “COMBs” (see “The Cost of GUIDs as Primary Keys”).

Changing the function name would break implementations, but at least the comment should be updated.

Steps To Reproduce

See description.

@crynobone
Copy link
Member

Hey there, thanks for reporting this issue.

If you notice improper DocBlock, PHPStan, or IDE warnings while using Laravel, do not create a GitHub issue. Instead, please submit a pull request to fix the problem. Also see our contribution guide.

Thanks!

wq9578 added a commit to wq9578/laravel-framework-pull-request-ordereduuid that referenced this issue Feb 26, 2024
taylorotwell added a commit that referenced this issue Feb 26, 2024
#50268)

* Correction comment for Str::orderedUuid() - #50231

* Update Str.php

---------

Co-authored-by: Taylor Otwell <taylor@laravel.com>
taylorotwell added a commit to illuminate/support that referenced this issue Feb 26, 2024
…(#50268)

* Correction comment for Str::orderedUuid() - laravel/framework#50231

* Update Str.php

---------

Co-authored-by: Taylor Otwell <taylor@laravel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants