Skip to content

Commit 89a2464

Browse files
committed
use more entropy with uniqid()
1 parent 23a162b commit 89a2464

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

Tests/Factory/HttpFoundationFactoryTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public function testCreateUploadedFile()
172172
$symfonyUploadedFile = $this->callCreateUploadedFile($uploadedFile);
173173
$size = $symfonyUploadedFile->getSize();
174174

175-
$uniqid = uniqid();
175+
$uniqid = uniqid('', true);
176176
$symfonyUploadedFile->move($this->tmpDir, $uniqid);
177177

178178
$this->assertEquals($uploadedFile->getSize(), $size);
@@ -198,7 +198,7 @@ public function testCreateUploadedFileWithError()
198198

199199
private function createUploadedFile(string $content, int $error, string $clientFileName, string $clientMediaType): UploadedFile
200200
{
201-
$filePath = tempnam($this->tmpDir, uniqid());
201+
$filePath = tempnam($this->tmpDir, uniqid('', true));
202202
file_put_contents($filePath, $content);
203203

204204
return new UploadedFile($filePath, filesize($filePath), $error, $clientFileName, $clientMediaType);

Tests/Factory/PsrHttpFactoryTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public function testGetContentCanBeCalledAfterRequestCreation()
131131

132132
private function createUploadedFile(string $content, string $originalName, string $mimeType, int $error): UploadedFile
133133
{
134-
$path = tempnam($this->tmpDir, uniqid());
134+
$path = tempnam($this->tmpDir, uniqid('', true));
135135
file_put_contents($path, $content);
136136

137137
return new UploadedFile($path, $originalName, $mimeType, $error, true);
@@ -182,7 +182,7 @@ public function testCreateResponseFromStreamed()
182182

183183
public function testCreateResponseFromBinaryFile()
184184
{
185-
$path = tempnam($this->tmpDir, uniqid());
185+
$path = tempnam($this->tmpDir, uniqid('', true));
186186
file_put_contents($path, 'Binary');
187187

188188
$response = new BinaryFileResponse($path);
@@ -194,7 +194,7 @@ public function testCreateResponseFromBinaryFile()
194194

195195
public function testCreateResponseFromBinaryFileWithRange()
196196
{
197-
$path = tempnam($this->tmpDir, uniqid());
197+
$path = tempnam($this->tmpDir, uniqid('', true));
198198
file_put_contents($path, 'Binary');
199199

200200
$request = new Request();

Tests/Functional/CovertTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ public static function responseProvider(): array
217217

218218
private static function createUploadedFile(string $content, string $originalName, string $mimeType, int $error): UploadedFile
219219
{
220-
$path = tempnam(sys_get_temp_dir(), uniqid());
220+
$path = tempnam(sys_get_temp_dir(), uniqid('', true));
221221
file_put_contents($path, $content);
222222

223223
return new UploadedFile($path, $originalName, $mimeType, $error, true);

0 commit comments

Comments
 (0)