Skip to content

Commit ee24f59

Browse files
authored
Merge pull request #2761 from PHPOffice/Reduce-Size-of-Cell-Collection-Unique-ID
Reduce size of Unique ID Prefix used for the Cell Collection
2 parents 9275d0c + ad56616 commit ee24f59

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/PhpSpreadsheet/Collection/Cells.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use PhpOffice\PhpSpreadsheet\Cell\Cell;
77
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
88
use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException;
9+
use PhpOffice\PhpSpreadsheet\Settings;
910
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
1011
use Psr\SimpleCache\CacheInterface;
1112

@@ -298,7 +299,9 @@ public function getHighestRow($column = null)
298299
*/
299300
private function getUniqueID()
300301
{
301-
return uniqid('phpspreadsheet.', true) . '.';
302+
return Settings::getCache() instanceof Memory
303+
? random_bytes(7) . ':'
304+
: uniqid('phpspreadsheet.', true) . '.';
302305
}
303306

304307
/**

0 commit comments

Comments
 (0)