Skip to content

Commit 8152a02

Browse files
committed
use more entropy with random_bytes()
1 parent 031dde7 commit 8152a02

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/ConnectionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ public static function provideIdPatterns(): \Generator
397397
{
398398
yield 'No delay' => ['/^THE_MESSAGE_ID$/', 0, 'xadd', 'THE_MESSAGE_ID'];
399399

400-
yield '100ms delay' => ['/^[a-f\d]+$/', 100, 'rawCommand', '1'];
400+
yield '100ms delay' => ['/^[A-Z\d\/+]+$/i', 100, 'rawCommand', '1'];
401401
}
402402

403403
public function testInvalidSentinelMasterName()

src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ public function add(string $body, array $headers, int $delayInMs = 0): string
521521

522522
try {
523523
if ($delayInMs > 0) { // the delay is <= 0 for queued messages
524-
$id = bin2hex(random_bytes(4));
524+
$id = base64_encode(random_bytes(9));
525525
$message = json_encode([
526526
'body' => $body,
527527
'headers' => $headers,

src/Symfony/Component/Notifier/Bridge/Iqsms/IqsmsTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ protected function doSend(MessageInterface $message): SentMessage
6161
'phone' => $message->getPhone(),
6262
'text' => $message->getSubject(),
6363
'sender' => $message->getFrom() ?: $this->from,
64-
'clientId' => bin2hex(random_bytes(4)),
64+
'clientId' => base64_encode(random_bytes(9)),
6565
],
6666
],
6767
'login' => $this->login,

0 commit comments

Comments
 (0)