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

Also available in: Atom PDF