Skip to content

Commit 3facf95

Browse files
authored
more unique ID generation to prevent multiple attachments with same ID (Webklex#363)
1 parent bbc5254 commit 3facf95

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Attachment.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ protected function fetch(): void {
202202
if (($id = $this->part->id) !== null) {
203203
$this->id = str_replace(['<', '>'], '', $id);
204204
}else{
205-
$this->id = hash("sha256", (string)microtime(true));
205+
$this->id = hash("sha256", uniqid((string) rand(10000, 99999), true));
206206
}
207207

208208
$this->size = $this->part->bytes;
@@ -339,4 +339,4 @@ public function mask(string $mask = null): mixed {
339339

340340
throw new MaskNotFoundException("Unknown mask provided: ".$mask);
341341
}
342-
}
342+
}

0 commit comments

Comments
 (0)