From f7e3db6e1480c85afd1272315dbe967af53bbf2c Mon Sep 17 00:00:00 2001 From: Maelan LE BORGNE Date: Wed, 3 Jul 2024 11:15:46 +0200 Subject: [PATCH] Replace uniqid in operation id generation default closure --- src/Builder/Pdf/AbstractPdfBuilder.php | 2 +- src/Builder/Screenshot/AbstractScreenshotBuilder.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Builder/Pdf/AbstractPdfBuilder.php b/src/Builder/Pdf/AbstractPdfBuilder.php index b72e8b00..5796c2ae 100644 --- a/src/Builder/Pdf/AbstractPdfBuilder.php +++ b/src/Builder/Pdf/AbstractPdfBuilder.php @@ -72,7 +72,7 @@ public function __construct( }, ]; - $this->operationIdGenerator = static fn (): string => uniqid('gotenberg_', true); + $this->operationIdGenerator = static fn (): string => 'gotenberg_'.bin2hex(random_bytes(16)).microtime(true); } public function setLogger(LoggerInterface|null $logger): void diff --git a/src/Builder/Screenshot/AbstractScreenshotBuilder.php b/src/Builder/Screenshot/AbstractScreenshotBuilder.php index 7625a625..a70f5121 100644 --- a/src/Builder/Screenshot/AbstractScreenshotBuilder.php +++ b/src/Builder/Screenshot/AbstractScreenshotBuilder.php @@ -63,7 +63,7 @@ public function __construct( }, ]; - $this->operationIdGenerator = fn () => uniqid('gotenberg_', true); + $this->operationIdGenerator = static fn (): string => 'gotenberg_'.bin2hex(random_bytes(16)).microtime(true); } public function setLogger(LoggerInterface|null $logger): void