Commit 6465f2f0 authored by Nicole Cordes's avatar Nicole Cordes Committed by Christian Kuhn
Browse files

[FEATURE] Introduce internal uniqueId generator

This patch add the function StringUtility::getUniqueId() which gets
an unique id (with using more entropy for Windows users) and removes
the included dot to be able to use the generated id in HTML as the dot
is an invalid character in some tag attributes e.g. id.

Resolves: #69730
Releases: master
Change-Id: Ic8a83df0a8b02f6778f0f5588d237379d909b59e
Reviewed-on: http://review.typo3.org/43244


Reviewed-by: default avatarMorton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: default avatarMorton Jonuschat <m.jonuschat@mojocode.de>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 66a3a980
......@@ -14,10 +14,10 @@ namespace TYPO3\CMS\Backend\Form\Container;
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Lang\LanguageService;
......@@ -110,7 +110,7 @@ class FlexFormSectionContainer extends AbstractContainer {
$options['renderType'] = 'flexFormContainerContainer';
$flexFormContainerContainerTemplateResult = $this->nodeFactory->create($options)->render();
$uniqueId = str_replace('.', '', uniqid('idvar', TRUE));
$uniqueId = StringUtility::getUniqueId('idvar');
$identifierPrefixJs = 'replace(/' . $flexFormFieldIdentifierPrefix . '-/g,"' . $flexFormFieldIdentifierPrefix . '-"+' . $uniqueId . '+"-")';
$identifierPrefixJs .= '.replace(/(tceforms-(datetime|date)field-)/g,"$1" + (new Date()).getTime())';
......
......@@ -17,7 +17,6 @@ namespace TYPO3\CMS\Backend\Form\Element;
use TYPO3\CMS\Backend\Form\FormDataCompiler;
use TYPO3\CMS\Backend\Form\FormDataGroup\OnTheFly;
use TYPO3\CMS\Backend\Form\FormDataProvider\TcaSelectItems;
use TYPO3\CMS\Backend\Form\FormEngine;
use TYPO3\CMS\Backend\Template\DocumentTemplate;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
......@@ -25,8 +24,8 @@ use TYPO3\CMS\Lang\LanguageService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Backend\Form\Wizard\SuggestWizard;
use TYPO3\CMS\Backend\Form\Wizard\ValueSliderWizard;
use TYPO3\CMS\Core\Utility\ArrayUtility;
......@@ -434,7 +433,7 @@ abstract class AbstractFormElement extends AbstractNode {
}
$otherWizards[] =
'<select' .
' id="' . str_replace('.', '', uniqid('tceforms-select-', TRUE)) . '"' .
' id="' . StringUtility::getUniqueId('tceforms-select-') . '"' .
' class="form-control tceforms-select tceforms-wizardselect"' .
' name="_WIZARD' . $fName . '"' .
' onchange="' . htmlspecialchars($assignValue . ';this.blur();this.selectedIndex=0;' . implode('', $fieldChangeFunc)) . '"'.
......@@ -563,7 +562,7 @@ abstract class AbstractFormElement extends AbstractNode {
: $params['size'];
if (!$selector) {
$isMultiple = $params['maxitems'] != 1 && $params['size'] != 1;
$selector = '<select id="' . str_replace('.', '', uniqid('tceforms-multiselect-', TRUE)) . '" '
$selector = '<select id="' . StringUtility::getUniqueId('tceforms-multiselect-') . '" '
. ($params['noList'] ? 'style="display: none"' : 'size="' . $sSize . '" class="form-control tceforms-multiselect"')
. ($isMultiple ? ' multiple="multiple"' : '')
. ' name="' . $fName . '_list" ' . $this->getValidationDataAsDataAttribute($config) . $onFocus . $params['style'] . $disabled . '>' . implode('', $opt)
......
......@@ -20,6 +20,7 @@ use TYPO3\CMS\Core\Resource\File;
use TYPO3\CMS\Core\Resource\ResourceFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
use TYPO3\CMS\Extbase\Utility\ArrayUtility;
/**
......@@ -96,7 +97,7 @@ class ImageManipulationElement extends AbstractFormElement {
$config['ratios'][$ratio] = $languageService->sL($label, TRUE);
}
$formFieldId = str_replace('.', '', uniqid('formengine-image-manipulation-', TRUE));
$formFieldId = StringUtility::getUniqueId('formengine-image-manipulation-');
$wizardData = array(
'file' => $file->getUid(),
'zoom' => $config['enableZoom'] ? '1' : '0',
......
......@@ -19,6 +19,7 @@ use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
/**
* Generation of TCEform elements of the type "input"
......@@ -168,7 +169,7 @@ class InputElement extends AbstractFormElement {
// calculate attributes
$attributes['data-formengine-validation-rules'] = $this->getValidationDataAsJsonString($config);
$attributes['data-formengine-input-params'] = json_encode($paramsList);
$attributes['id'] = str_replace('.', '', uniqid('formengine-input-', TRUE));
$attributes['id'] = StringUtility::getUniqueId('formengine-input-');
$attributes['name'] = $parameterArray['itemFormElName'] . '_hr';
$attributes['value'] = '';
if (isset($config['max']) && (int)$config['max'] > 0) {
......
......@@ -16,7 +16,7 @@ namespace TYPO3\CMS\Backend\Form\Element;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility;
......@@ -145,7 +145,7 @@ class SelectCheckBoxElement extends AbstractFormElement {
// Build item array
$groups[$currentGroup]['items'][] = array(
'id' => str_replace('.', '', uniqid('select_checkbox_row_', TRUE)),
'id' => StringUtility::getUniqueId('select_checkbox_row_'),
'name' => $parameterArray['itemFormElName'] . '[' . $c . ']',
'value' => $p[1],
'checked' => $checked,
......@@ -165,7 +165,7 @@ class SelectCheckBoxElement extends AbstractFormElement {
foreach ($itemArray as $theNoMatchValue => $temp) {
// Build item array
$groups[$currentGroup]['items'][] = array(
'id' => str_replace('.', '', uniqid('select_checkbox_row_', TRUE)),
'id' => StringUtility::getUniqueId('select_checkbox_row_'),
'name' => $parameterArray['itemFormElName'] . '[' . $c . ']',
'value' => $theNoMatchValue,
'checked' => 1,
......
......@@ -14,9 +14,9 @@ namespace TYPO3\CMS\Backend\Form\Element;
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Core\Utility\ArrayUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
......@@ -161,7 +161,7 @@ class SelectMultipleSideBySideElement extends AbstractFormElement {
: '';
$sOnChange = implode('', $parameterArray['fieldChangeFunc']);
$multiSelectId = str_replace('.', '', uniqid('tceforms-multiselect-', TRUE));
$multiSelectId = StringUtility::getUniqueId('tceforms-multiselect-');
$itemsToSelect = '
<select data-relatedfieldname="' . htmlspecialchars($parameterArray['itemFormElName']) . '" data-exclusivevalues="'
. htmlspecialchars($config['exclusiveKeys']) . '" id="' . $multiSelectId . '" name="' . htmlspecialchars($parameterArray['itemFormElName']) . '_sel" '
......
......@@ -17,7 +17,7 @@ namespace TYPO3\CMS\Backend\Form\Element;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility;
......@@ -137,7 +137,7 @@ class SelectSingleBoxElement extends AbstractFormElement {
$size = $config['autoSizeMax']
? MathUtility::forceIntegerInRange(count($selItems) + 1, MathUtility::forceIntegerInRange($size, 1), $config['autoSizeMax'])
: $size;
$selectBox = '<select id="' . str_replace('.', '', uniqid($cssPrefix, TRUE)) . '" name="' . htmlspecialchars($parameterArray['itemFormElName']) . '[]" '
$selectBox = '<select id="' . StringUtility::getUniqueId($cssPrefix) . '" name="' . htmlspecialchars($parameterArray['itemFormElName']) . '[]" '
. 'class="form-control ' . $cssPrefix . '"' . ($size ? ' size="' . $size . '" ' : '')
. ' multiple="multiple" onchange="' . htmlspecialchars($sOnChange) . '"' . $parameterArray['onFocus']
. ' ' . $this->getValidationDataAsDataAttribute($config) . $selector_itemListStyle . $disabled . '>
......
......@@ -15,7 +15,7 @@ namespace TYPO3\CMS\Backend\Form\Element;
*/
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility;
use TYPO3\CMS\Backend\Form\InlineStackProcessor;
......@@ -110,7 +110,7 @@ class SelectSingleElement extends AbstractFormElement {
}
// Initialization:
$selectId = str_replace('.', '', uniqid('tceforms-select-', TRUE));
$selectId = StringUtility::getUniqueId('tceforms-select-');
$selectedIndex = 0;
$selectedIcon = '';
$selectedValueFound = FALSE;
......
......@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Backend\Form\Element;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
/**
......@@ -139,7 +140,7 @@ class TextElement extends AbstractFormElement {
}
// calculate attributes
$attributes['id'] = str_replace('.', '', uniqid('formengine-textarea-', TRUE));
$attributes['id'] = StringUtility::getUniqueId('formengine-textarea-');
$attributes['name'] = $parameterArray['itemFormElName'];
if (!empty($styles)) {
$attributes['style'] = implode(' ', $styles);
......
......@@ -15,7 +15,7 @@ namespace TYPO3\CMS\Backend\Form\FormDataProvider;
*/
use TYPO3\CMS\Backend\Form\FormDataProviderInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
/**
* On "new" command, initialize uid with an unqique uid
......@@ -40,10 +40,8 @@ class DatabaseUniqueUidNewRow implements FormDataProviderInterface {
1437991120
);
}
// @todo: There is a dot in this uid that can give us headaches if the
// @todo: uid is used as id argument in HTML. It would probably better
// @todo: to remove the dot here already.
$result['databaseRow']['uid'] = uniqid('NEW', TRUE);
$result['databaseRow']['uid'] = StringUtility::getUniqueId('NEW');
return $result;
}
......
......@@ -20,6 +20,7 @@ use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
use TYPO3\CMS\Core\Versioning\VersionState;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
......@@ -122,7 +123,7 @@ class InlineRelatedRecordResolver {
if (!empty($foreignTranslationPointerField)) {
$record[$foreignTranslationPointerField] = $record['uid'];
}
$newId = uniqid('NEW', TRUE);
$newId = StringUtility::getUniqueId('NEW');
$record['uid'] = $newId;
$record['pid'] = $inlineFirstPid;
$relatedRecords['records'][$newId] = $record;
......@@ -141,7 +142,7 @@ class InlineRelatedRecordResolver {
*/
public function getNewRecord($pid, $table) {
$record = $this->getRecord($table, $pid, 'new');
$record['uid'] = uniqid('NEW', TRUE);
$record['uid'] = StringUtility::getUniqueId('NEW');
$newRecordPid = $pid;
$pageTS = BackendUtility::getPagesTSconfig($pid);
// @todo: this is to force new foreign records to a different pid via pageTS - should be handled elsewhere
......
......@@ -25,6 +25,7 @@ use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Core\Type\Bitmask\Permission;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
use TYPO3\CMS\Core\Versioning\VersionState;
use TYPO3\CMS\Extbase\Service\FlexFormService;
use TYPO3\CMS\Fluid\View\StandaloneView;
......@@ -484,8 +485,8 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
. $this->getLanguageService()->getLL('content', TRUE) . '</a>';
}
$content[$key] .= '
<div class="t3-page-ce t3js-page-ce" data-page="' . (int)$id . '" id="' . str_replace('.', '', uniqid('', TRUE)) . '">
<div class="t3js-page-new-ce t3-page-ce-wrapper-new-ce" id="colpos-' . $key . '-' . 'page-' . $id . '-' . uniqid('', TRUE) . '">'
<div class="t3-page-ce t3js-page-ce" data-page="' . (int)$id . '" id="' . StringUtility::getUniqueId() . '">
<div class="t3js-page-new-ce t3-page-ce-wrapper-new-ce" id="colpos-' . $key . '-' . 'page-' . $id . '-' . StringUtility::getUniqueId() . '">'
. $link
. '</div>
<div class="t3-page-ce-dropzone-available t3js-page-ce-dropzone-available"></div>
......@@ -515,7 +516,7 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
$editUidList .= $row['uid'] . ',';
$disableMoveAndNewButtons = $this->defLangBinding && $lP > 0;
if (!$this->tt_contentConfig['languageMode']) {
$singleElementHTML .= '<div class="t3-page-ce-dragitem" id="' . str_replace('.', '', uniqid('', TRUE)) . '">';
$singleElementHTML .= '<div class="t3-page-ce-dragitem" id="' . StringUtility::getUniqueId() . '">';
}
$singleElementHTML .= $this->tt_content_drawHeader(
$row,
......@@ -538,7 +539,7 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
$singleElementHTML .= '<div class="t3-page-ce t3js-page-ce">';
}
$singleElementHTML .= '<div class="t3js-page-new-ce t3-page-ce-wrapper-new-ce" id="colpos-' . $key . '-' . 'page-' . $id .
'-' . str_replace('.', '', uniqid('', TRUE)) . '">';
'-' . StringUtility::getUniqueId() . '">';
// Add icon "new content element below"
if (!$disableMoveAndNewButtons && $this->getPageLayoutController()->pageIsNotLockedForEditors()) {
// New content element:
......
......@@ -13,7 +13,9 @@ namespace TYPO3\CMS\Core\Cache\Backend;
*
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
use TYPO3\CMS\Core\Service\OpcodeCacheService;
/**
......@@ -146,7 +148,7 @@ class FileBackend extends \TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend implem
throw new \RuntimeException(sprintf('Cannot add or modify cache entry because the backend of cache "%s" is frozen.', $this->cacheIdentifier), 1323344192);
}
$this->remove($entryIdentifier);
$temporaryCacheEntryPathAndFilename = $this->cacheDirectory . uniqid('', TRUE) . '.temp';
$temporaryCacheEntryPathAndFilename = $this->cacheDirectory . StringUtility::getUniqueId() . '.temp';
$lifetime = $lifetime === NULL ? $this->defaultLifetime : $lifetime;
$expiryTime = $lifetime === 0 ? 0 : $GLOBALS['EXEC_TIME'] + $lifetime;
$metaData = str_pad($expiryTime, self::EXPIRYTIME_LENGTH) . implode(' ', $tags) . str_pad(strlen($data), self::DATASIZE_DIGITS);
......
......@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Core\Cache\Backend;
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Core\Utility\StringUtility;
/**
* A caching backend which stores cache entries by using Redis with phpredis
* PHP module. Redis is a noSQL database with very good scaling characteristics
......@@ -474,7 +476,7 @@ class RedisBackend extends AbstractBackend implements TaggableBackendInterface {
protected function removeIdentifierEntriesAndRelations(array $identifiers, array $tags) {
// Set a temporary entry which holds all identifiers that need to be removed from
// the tag to identifiers sets
$uniqueTempKey = 'temp:' . uniqid('', TRUE);
$uniqueTempKey = 'temp:' . StringUtility::getUniqueId();
$prefixedKeysToDelete = array($uniqueTempKey);
$prefixedIdentifierToTagsKeysToDelete = array();
foreach ($identifiers as $identifier) {
......
......@@ -10,8 +10,10 @@ namespace TYPO3\CMS\Core\Cache\Backend;
* *
* The TYPO3 project - inspiring people to share! *
* */
use TYPO3\CMS\Core\Service\OpcodeCacheService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
/**
* A caching backend which stores cache entries in files, but does not support or
......@@ -237,7 +239,7 @@ class SimpleFileBackend extends \TYPO3\CMS\Core\Cache\Backend\AbstractBackend im
if ($entryIdentifier === '') {
throw new \InvalidArgumentException('The specified entry identifier must not be empty.', 1334756736);
}
$temporaryCacheEntryPathAndFilename = $this->cacheDirectory . uniqid('', TRUE) . '.temp';
$temporaryCacheEntryPathAndFilename = $this->cacheDirectory . StringUtility::getUniqueId() . '.temp';
$result = file_put_contents($temporaryCacheEntryPathAndFilename, $data);
\TYPO3\CMS\Core\Utility\GeneralUtility::fixPermissions($temporaryCacheEntryPathAndFilename);
if ($result === FALSE) {
......
......@@ -32,6 +32,7 @@ use TYPO3\CMS\Core\Utility\File\BasicFileUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Core\Utility\PathUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
use TYPO3\CMS\Core\Versioning\VersionState;
/**
......@@ -3375,7 +3376,7 @@ class DataHandler {
}
// Initializing:
$theNewID = uniqid('NEW', TRUE);
$theNewID = StringUtility::getUniqueId('NEW');
$enableField = isset($GLOBALS['TCA'][$table]['ctrl']['enablecolumns']) ? $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'] : '';
$headerField = $GLOBALS['TCA'][$table]['ctrl']['label'];
// Getting default data:
......@@ -3628,7 +3629,7 @@ class DataHandler {
* @return int Returns the new ID of the record (if applicable)
*/
public function insertNewCopyVersion($table, $fieldArray, $realPid) {
$id = uniqid('NEW', TRUE);
$id = StringUtility::getUniqueId('NEW');
// $fieldArray is set as current record.
// The point is that when new records are created as copies with flex type fields there might be a field containing information about which DataStructure to use and without that information the flexforms cannot be correctly processed.... This should be OK since the $checkValueRecord is used by the flexform evaluation only anyways...
$this->checkValue_currentRecord = $fieldArray;
......
......@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Core\Database;
*/
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
/**
* Contains the class "DatabaseConnection" containing functions for building SQL queries
......@@ -334,7 +335,7 @@ class DatabaseConnection {
* @see exec_SELECTquery()
*/
public function exec_SELECT_mm_query($select, $local_table, $mm_table, $foreign_table, $whereClause = '', $groupBy = '', $orderBy = '', $limit = '') {
$foreign_table_as = $foreign_table == $local_table ? $foreign_table . str_replace('.', '', uniqid('_join', TRUE)) : '';
$foreign_table_as = $foreign_table == $local_table ? $foreign_table . StringUtility::getUniqueId('_join') : '';
$mmWhere = $local_table ? $local_table . '.uid=' . $mm_table . '.uid_local' : '';
$mmWhere .= ($local_table and $foreign_table) ? ' AND ' : '';
$tables = ($local_table ? $local_table . ',' : '') . $mm_table;
......
......@@ -18,6 +18,7 @@ use TYPO3\CMS\Backend\Module\BaseScriptClass;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
use TYPO3\CMS\Lang\LanguageService;
/**
......@@ -1604,7 +1605,7 @@ class QueryGenerator {
protected function getDateTimePickerField($name, $timestamp, $type) {
$dateFormat = $GLOBALS['TYPO3_CONF_VARS']['SYS']['USdateFormat'] ? '%H:%M %m-%d-%Y' : '%H:%M %d-%m-%Y';
$value = ($timestamp > 0 ? strftime($dateFormat, $timestamp) : '');
$id = uniqid('dt_');
$id = StringUtility::getUniqueId('dt_');
$html = array();
$html[] = '<div class="input-group" id="' . $id . '-wrapper">';
$html[] = ' <input name="' . htmlspecialchars($name) . '_hr" value="' . $value . '" class="form-control t3js-datetimepicker t3js-clearable" data-date-type="' . htmlspecialchars($type) . '" data-date-offset="0" type="text" id="' . $id . '">';
......
......@@ -19,6 +19,7 @@ use TYPO3\CMS\Core\Core\ClassLoadingInformation;
use TYPO3\CMS\Core\Service\OpcodeCacheService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\PathUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
/**
* The default TYPO3 Package Manager
......@@ -189,7 +190,7 @@ class PackageManager implements \TYPO3\CMS\Core\SingletonInterface {
$cacheEntryIdentifier = $this->getCacheEntryIdentifier();
if ($cacheEntryIdentifier !== NULL && !$this->coreCache->has($cacheEntryIdentifier)) {
// Package objects get their own cache entry, so PHP does not have to parse the serialized string
$packageObjectsCacheEntryIdentifier = str_replace('.', '', uniqid('PackageObjects_', TRUE));
$packageObjectsCacheEntryIdentifier = StringUtility::getUniqueId('PackageObjects_');
// Build cache file
$packageCache = array(
'packageStatesConfiguration' => $this->packageStatesConfiguration,
......
......@@ -19,6 +19,7 @@ use TYPO3\CMS\Core\Core\ClassLoadingInformation;
use TYPO3\CMS\Core\Imaging\GraphicalFunctions;
use TYPO3\CMS\Core\Service\OpcodeCacheService;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\StringUtility;
use TYPO3\CMS\Frontend\Page\PageRepository;
/**
......@@ -1232,7 +1233,7 @@ class GeneralUtility {
static protected function generateRandomBytesFallback($bytesToReturn) {
$bytes = '';
// We initialize with somewhat random.
$randomState = $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] . base_convert(memory_get_usage() % pow(10, 6), 10, 2) . microtime() . uniqid('', TRUE) . getmypid();
$randomState = $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] . base_convert(memory_get_usage() % pow(10, 6), 10, 2) . microtime() . StringUtility::getUniqueId() . getmypid();
while (!isset($bytes[($bytesToReturn - 1)])) {
$randomState = sha1(microtime() . mt_rand() . $randomState);
$bytes .= sha1(mt_rand() . $randomState, TRUE);
......@@ -2822,7 +2823,7 @@ Connection: close
$result = FALSE;
if (is_dir($directory)) {
$temporaryDirectory = rtrim($directory, '/') . '.' . uniqid('remove', TRUE) . '/';
$temporaryDirectory = rtrim($directory, '/') . '.' . StringUtility::getUniqueId('remove') . '/';
if (rename($directory, $temporaryDirectory)) {
if ($flushOpcodeCache) {
GeneralUtility::makeInstance(OpcodeCacheService::class)->clearAllActive($directory);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment