[BUGFIX] Change comparison in BasicFileUtility 85/60885/4
authorGeorg Ringer <georg.ringer@gmail.com>
Thu, 6 Jun 2019 03:20:15 +0000 (05:20 +0200)
committerDaniel Goerz <daniel.goerz@posteo.de>
Mon, 1 Jul 2019 19:52:34 +0000 (21:52 +0200)
Due to an unrelated change within #76257,
BasicFileUtility never accounts for proper
creating a randomly unique name.

Resolves: #88455
Related: #76257
Releases: master, 9.5, 8.7
Change-Id: I41fe95a9b5b68a7d29cf529f0877331197990940
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60885
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de>
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Daniel Goerz <daniel.goerz@posteo.de>
typo3/sysext/core/Classes/Utility/File/BasicFileUtility.php

index f7ce30b..e63b9a6 100644 (file)
@@ -173,7 +173,7 @@ class BasicFileUtility
             $theTempFileBody = preg_replace('/_[0-9][0-9]$/', '', $origFileInfo['filebody']);
             // This removes _xx if appended to the file
             $theOrigExt = $origFileInfo['realFileext'] ? '.' . $origFileInfo['realFileext'] : '';
-            for ($a = 1; $a < $this->maxNumber; $a++) {
+            for ($a = 1; $a <= $this->maxNumber + 1; $a++) {
                 if ($a <= $this->maxNumber) {
                     // First we try to append numbers
                     $insert = '_' . sprintf('%02d', $a);