Project

General

Profile

Actions

Task #69050

closed

Supply a Utility method to create unique ids in the core

Added by Stephan Großberndt over 9 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Backend API
Target version:
Start date:
2015-08-14
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

Currently there are about hundred places in core where unique ids are created using different code:


On windows and in cygwin environments uniqid() has a resolution of one second which results in identical ids if uniqid('Foo'); or uniqid('Foo', TRUE); is called.

We need a utility method that creates unique ids even if called multiple times a second. its ids must not contain . (dots) (added by the , TRUE)) so they are valid in JavaScript context too. In some contexts the ids must start with a letter to be valid.


Files

uniqid.txt (10.1 KB) uniqid.txt Stephan Großberndt, 2015-08-14 11:22

Related issues 4 (0 open4 closed)

Related to TYPO3 Core - Bug #69039: Functional Tests: NEWid generation in tests does not match coreClosedMorton Jonuschat2015-08-14

Actions
Related to TYPO3 Core - Bug #59701: uniqid() not returning unique valuesClosedTymoteusz Motylewski2014-06-20

Actions
Related to TYPO3 Core - Bug #63943: PHPUnit-Tests fail on WindowsClosedStephan Großberndt2014-12-16

Actions
Precedes TYPO3 Core - Task #69730: Remove dot in uniqid('NEW', TRUE)ClosedNicole Cordes2015-09-12

Actions
Actions #1

Updated by Stephan Großberndt over 9 years ago

Updated by Roman Eberle 3 months ago on #59701:

i think a better solution would be to create something like

...\GeneralUtility\UniqueId()

which unifies the generation of unique ids, and replace all calls to uniqid() with calls to that function.
this might be done with a smart shell-script (grep/sed), should fix pretty much all uniqid()-related errors, and allows easy modification for possible future changes to unique-id-generation.

note that I encountered typo3-exceptions related to PATTERN_ENTRYIDENTIFIER in sysext/core/Classes/Cache/Frontend/FrontendInterface.php with TYPO3 6.2.12, these don't seem to be covered by the above commits/patches.

Actions #2

Updated by Stephan Großberndt over 9 years ago

if used as uids for records (e.g. in typo3/sysext/core/Tests/Functional/DataHandling/Framework/ActionService.php) there is a limit of currently 30 chars imposed by the NEWid field in sys_log

Actions #3

Updated by Mathias Brodala about 9 years ago

  • Status changed from New to Resolved
  • Assignee set to Nicole Cordes
  • Sprint Focus set to On Location Sprint

This was fixed with #69730.

Actions #4

Updated by Anja Leichsenring almost 9 years ago

  • Sprint Focus deleted (On Location Sprint)
Actions #5

Updated by Riccardo De Contardi about 7 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF