Project

General

Profile

Actions

Bug #88455

closed

Never attach random string if file already exists in folder

Added by Thomas Walder almost 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2019-05-29
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

\TYPO3\CMS\Core\Utility\File\BasicFileUtility::getUniqueName

The inner condition never can be reached if $a equals $this->maxNumber. Result is, that "then we try unique-strings" never can be executed

for ($a = 1; $a < $this->maxNumber; $a++) {
    if ($a <= $this->maxNumber) {
        // First we try to append numbers
        $insert = '_' . sprintf('%02d', $a);
    } else {
        // .. then we try unique-strings...
        $insert = '_' . substr(md5(uniqid('', true)), 0, $this->uniquePrecision);
    }

Working Code

for ($a = 1; $a <= $this->maxNumber; $a++) {
    if ($a < $this->maxNumber) {
        // First we try to append numbers
        $insert = '_' . sprintf('%02d', $a);
    } else {
        // .. then we try unique-strings...
        $insert = '_' . substr(md5(uniqid('', true)), 0, $this->uniquePrecision);
    }

The change was made in 30282eef79e069fe78ea39e53df2fc003bc6c2f4 [!!!][TASK] Cleanup and remove old filefunc logic on 2016-01-08 by Benni Mack


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Task #76257: Cleanup and remove old filefunc logicClosedBenni Mack2016-05-22

Actions
Is duplicate of TYPO3 Core - Bug #88332: incorrect generation of unique file name in BasicFileUtilityClosed2019-05-10

Actions
Actions #1

Updated by Thomas Walder almost 5 years ago

  • Description updated (diff)
Actions #2

Updated by Georg Ringer almost 5 years ago

  • Related to Task #76257: Cleanup and remove old filefunc logic added
Actions #3

Updated by Gerrit Code Review almost 5 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60885

Actions #4

Updated by Georg Ringer almost 5 years ago

  • Is duplicate of Bug #88332: incorrect generation of unique file name in BasicFileUtility added
Actions #5

Updated by Georg Ringer almost 5 years ago

  • Status changed from Under Review to Closed

Thanks for your report! I am fixing this with issue #88455 and therefore closing this one as duplicate.

Actions #6

Updated by Stephan Großberndt almost 5 years ago

  • Status changed from Closed to Under Review
Actions #7

Updated by Gerrit Code Review over 4 years ago

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61179

Actions #8

Updated by Georg Ringer over 4 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #9

Updated by Gerrit Code Review over 4 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61536

Actions #10

Updated by Georg Ringer over 4 years ago

  • Status changed from Under Review to Resolved
Actions #11

Updated by Benni Mack over 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF