Remove check whether a internalId is already used
authorJoshua Rüsweg <josh@bastelstu.be>
Thu, 10 Jan 2019 13:20:28 +0000 (14:20 +0100)
committerJoshua Rüsweg <josh@bastelstu.be>
Thu, 10 Jan 2019 13:29:30 +0000 (14:29 +0100)
See #2825

wcfsetup/install/files/lib/system/file/upload/UploadHandler.class.php

index 2515b11847f3e7204eeaf86ab9223f5763f76e2b..3272bae2ad55a39094b31b379af05a1cff7c3fbc 100644 (file)
@@ -3,6 +3,7 @@ namespace wcf\system\file\upload;
 use wcf\system\exception\ImplementationException;
 use wcf\system\SingletonFactory;
 use wcf\system\WCF;
+use wcf\util\StringUtil;
 
 /**
  * Handles uploads for files.
@@ -44,10 +45,7 @@ class UploadHandler extends SingletonFactory {
                        $this->fields[$field->getFieldId()] = $field;
                }
                else {
-                       do {
-                               $internalId = bin2hex(random_bytes(32));
-                       } 
-                       while (in_array($internalId, $this->getKnownInternalIds()));
+                       $internalId = StringUtil::getRandomID();
                        
                        $field->setInternalId($internalId);