Bug #58602
closedDatepicker issue on multiple datetime fields in BE
100%
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
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 ...
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.
Updated by Marc Bastian Heinrichs over 10 years ago
- Assignee deleted (
Marc Bastian Heinrichs)
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
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
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
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
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
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
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
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
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
Updated by Tymoteusz Motylewski about 10 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset fa817a7e4c36c2d4dd5858582462ce426fe9bc29.
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
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
Updated by Tymoteusz Motylewski almost 10 years ago
- Status changed from Under Review to Resolved
Applied in changeset 5df3d530de1d3c57b3da378175f02a0256ccf1c7.
Updated by Stephan Großberndt over 4 years ago
- Related to Bug #91553: Risk of non-unique field in DatePickerViewHelper added