Merge pull request #2761 from PHPOffice/Reduce-Size-of-Cell-Collection-Unique-ID

Reduce size of Unique ID Prefix used for the Cell Collection
This commit is contained in:
Mark Baker 2022-04-20 20:42:51 +02:00 committed by GitHub
commit ee24f59af1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -6,6 +6,7 @@ use Generator;
use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException;
use PhpOffice\PhpSpreadsheet\Settings;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
use Psr\SimpleCache\CacheInterface;
@ -298,7 +299,9 @@ class Cells
*/
private function getUniqueID()
{
return uniqid('phpspreadsheet.', true) . '.';
return Settings::getCache() instanceof Memory
? random_bytes(7) . ':'
: uniqid('phpspreadsheet.', true) . '.';
}
/**