Project

General

Profile

Bug #88455

Updated by Thomas Walder about 5 years ago

\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 

 <pre><code class="php"> 
 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); 
     } 
 </code></pre> 

 Working Code 
 <pre><code class="php"> 
 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); 
     } 
 </code></pre> 

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


Back