Project

General

Profile

Actions

Bug #58602

closed

Datepicker issue on multiple datetime fields in BE

Added by Arno Burkhart over 10 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
DataHandler aka TCEmain
Target version:
Start date:
2014-05-07
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

After migrating our T3 Websites from 4.5 LTS to 6.2 LTS, we experienced a strange behaviour on the CE access tab for "Publish Dates and Access Rights". The datepicker for field "Expiration Date" applies the selected date in input field for "Publish Date" instead the expected input field for "Expiration Date". After some investigations we found out, that the used input id's are identical:

<input type="text" id="tceforms-datetimefield-536a4b3a16b9a" class="formField tceforms-textfield tceforms-datetimefield hasDefaultValue" name="data[tt_content][2][starttime]_hr" value=""style="width: 163px; " maxlength="20" onchange="typo3form.fieldGet('data[tt_content][2][starttime]','datetime','',1,'0');TBE_EDITOR.fieldChanged('tt_content','2','starttime','data[tt_content][2][starttime]');" />

<input type="text" id="tceforms-datetimefield-536a4b3a16b9a" class="formField tceforms-textfield tceforms-datetimefield upper-1609369200 hasDefaultValue" name="data[tt_content][2][endtime]_hr" value=""style="width: 163px; " maxlength="20" onchange="typo3form.fieldGet('data[tt_content][2][endtime]','datetime','',1,'0');TBE_EDITOR.fieldChanged('tt_content','2','endtime','data[tt_content][2][endtime]');" /><input type="hidden" name="data[tt_content][2][endtime]" value="0" />

Both id's are set to tceforms-datetimefield-536a4b3a16b9a which causes the issue. But this only happens on windows machines. Identical T3 installation moved to a Linux platform is working correct, as the ID's are unique there.

So wie investigated the code, responsible for rendering these fields in typo3\sysext\backend\Classes\Form\FormEngine.php. The referenced id is generated by PHP function uniqid. The referenced line here is 1322:

$inputId = uniqid('tceforms-' . $class . 'field-');

We found 2 ways to fix this issue on a windows machine:

1.) using the optional parameter more_entropy of function string uniqid ([ string $prefix = "" [, bool $more_entropy = false ]] ) and replacing line 1322 with
$inputId = uniqid('tceforms-' . $class . 'field-', true);

2.) a second solution on windows platform is using the PHP parameters session.entropy_file and session.entropy_length.

By each of these approaches, the ID's are getting unique and the datepicker is working as expected.

For getting platform independent, we propose to change the usage of function uniqid() using the optional parameter (true) in TYPO3 core in a future release. This issue also affect TYPO3 6.1.x


Related issues 6 (0 open6 closed)

Related to TYPO3 Core - Bug #59529: Make Functional tests work on fast machines (especially on Windows)ClosedTymoteusz Motylewski2014-06-12

Actions
Related to TYPO3 Core - Bug #59055: Import from .t3d failed on Windows 7 with a lot of messagesClosedMarc Bastian Heinrichs

Actions
Related to TYPO3 Core - Bug #58768: Import from .t3d failed on Windows 7 with a lot of messages (6.1 => 6.2)Rejected2014-05-13

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
Related to TYPO3 Core - Bug #91553: Risk of non-unique field in DatePickerViewHelperClosed2020-06-02

Actions
Actions #1

Updated by Christian Kuhn over 10 years ago

wah ... php madness ...

http://stackoverflow.com/questions/4070110/how-unique-is-uniqid

<quote>
"As others below note, without prefix and without "added entropy", this function simply returns the UNIX timestamp with added microsecond counter as a hex number; it's more or less just microtime(), in hexit form.

[...]

Also worth to note is that since microtime() only works on systems that have gettimeofday() > present, which Windows natively DOES NOT, uniqid() might yield just the single-second-resolution UNIX timestamp in a Windows environment."

"In other words without "more_entropy", the function is absolutely horrible and should never be used,"
</quote>

So, we should review the current usages of uniqid (maybe we leave out tests), to see if we should add the "more_entropy" parameter for cases where two uniqid() are possible during one request ...

Actions #2

Updated by Marc Bastian Heinrichs over 10 years ago

  • Category set to DataHandler aka TCEmain
  • Assignee set to Marc Bastian Heinrichs
  • Priority changed from -- undefined -- to Must have
  • Target version set to next-patchlevel

uniqid is also used in ImportExport for creating the 'NEW' id for new records, so this obviously the reason that breaks impexp on win.

Actions #3

Updated by Marc Bastian Heinrichs over 10 years ago

  • Assignee deleted (Marc Bastian Heinrichs)
Actions #4

Updated by Gerrit Code Review over 10 years ago

  • Status changed from New to Under Review

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30948

Actions #5

Updated by Gerrit Code Review over 10 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30948

Actions #6

Updated by Gerrit Code Review over 10 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30948

Actions #7

Updated by Gerrit Code Review over 10 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/30948

Actions #8

Updated by Gerrit Code Review about 10 years ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/30948

Actions #9

Updated by Gerrit Code Review about 10 years ago

Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/30948

Actions #10

Updated by Gerrit Code Review about 10 years ago

Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/30948

Actions #11

Updated by Gerrit Code Review about 10 years ago

Patch set 10 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/30948

Actions #12

Updated by Gerrit Code Review about 10 years ago

Patch set 11 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/30948

Actions #13

Updated by Tymoteusz Motylewski about 10 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #14

Updated by Gerrit Code Review about 10 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/33328

Actions #15

Updated by Gerrit Code Review about 10 years ago

Patch set 2 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/33328

Actions #16

Updated by Tymoteusz Motylewski almost 10 years ago

  • Status changed from Under Review to Resolved
Actions #17

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions #18

Updated by Stephan Großberndt over 4 years ago

  • Related to Bug #91553: Risk of non-unique field in DatePickerViewHelper added
Actions

Also available in: Atom PDF