Skip to content

Commit

Permalink
use more entropy with uniqid()
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Jul 15, 2024
1 parent 23a162b commit 89a2464
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Tests/Factory/HttpFoundationFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public function testCreateUploadedFile()
$symfonyUploadedFile = $this->callCreateUploadedFile($uploadedFile);
$size = $symfonyUploadedFile->getSize();

$uniqid = uniqid();
$uniqid = uniqid('', true);
$symfonyUploadedFile->move($this->tmpDir, $uniqid);

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

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

return new UploadedFile($filePath, filesize($filePath), $error, $clientFileName, $clientMediaType);
Expand Down
6 changes: 3 additions & 3 deletions Tests/Factory/PsrHttpFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function testGetContentCanBeCalledAfterRequestCreation()

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

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

public function testCreateResponseFromBinaryFile()
{
$path = tempnam($this->tmpDir, uniqid());
$path = tempnam($this->tmpDir, uniqid('', true));
file_put_contents($path, 'Binary');

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

public function testCreateResponseFromBinaryFileWithRange()
{
$path = tempnam($this->tmpDir, uniqid());
$path = tempnam($this->tmpDir, uniqid('', true));
file_put_contents($path, 'Binary');

$request = new Request();
Expand Down
2 changes: 1 addition & 1 deletion Tests/Functional/CovertTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public static function responseProvider(): array

private static function createUploadedFile(string $content, string $originalName, string $mimeType, int $error): UploadedFile
{
$path = tempnam(sys_get_temp_dir(), uniqid());
$path = tempnam(sys_get_temp_dir(), uniqid('', true));
file_put_contents($path, $content);

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

0 comments on commit 89a2464

Please sign in to comment.