Skip to content

Commit 3d4c11e

Browse files
committed
stop using uniqid() to create temporary files
1 parent 4861f0c commit 3d4c11e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Field/FileFormField.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ public function setValue(?string $value): void
5555
$name = $info['basename'];
5656

5757
// copy to a tmp location
58-
$tmp = sys_get_temp_dir().'/'.strtr(substr(base64_encode(hash('xxh128', uniqid(mt_rand(), true), true)), 0, 7), '/', '_');
58+
$tmp = tempnam(sys_get_temp_dir(), $name);
5959
if (\array_key_exists('extension', $info)) {
60+
unlink($tmp);
6061
$tmp .= '.'.$info['extension'];
6162
}
6263
if (is_file($tmp)) {

0 commit comments

Comments
 (0)