Skip to content

Commit

Permalink
Unique name is not very unique!
Browse files Browse the repository at this point in the history
The `date()` function always returns `000000` for microseconds according to the documentation https://www.php.net/manual/en/datetime.format.php
> Note that date() will always generate 000000 since it takes an int parameter, whereas DateTime::format() does support microseconds if DateTime was created with microseconds.

So `getUniqueName()` doesn't return a very unique name
  • Loading branch information
sylfabre authored Feb 8, 2022
1 parent 7384929 commit 9cf5a7d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/HeadlessChrome.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ public function getArguments()
*/
private function getUniqueName($extension)
{
return md5(date('Y-m-d H:i:s:u')) . '.' . $extension;
return md5((new \DateTime())->format('Y-m-d H:i:s:u')) . '.' . $extension;
}


Expand Down

0 comments on commit 9cf5a7d

Please sign in to comment.