Bug #84524
closedSimulateDate in Preview not working in 8.7.11
100%
Description
After upgrading from 8.7.10 to 8.7.11, the feature to simulate a specific time in the frontend via admin panel does not work anymore.
I can confirm that this feature was working in 8.7.10.
The request after clicking "Update" in the admin panel contains 2 parameters:
TSFE_ADMIN_PANEL[preview_simulateDate]_hr TSFE_ADMIN_PANEL[preview_simulateDate]
In 8.7.11, the parameter TSFE_ADMIN_PANEL[preview_simulateDate] holds a unix timestamp with a wrong value.
Updated by Robert Lang over 6 years ago
- Priority changed from Should have to Must have
- Complexity set to easy
- Is Regression set to Yes
I can confirm this bug still exists in TYPO3 8.7.12
The reason behind this is a wrong concatenation of JavaScript values in Line 468 in File typo3/sysext/frontend/Classes/View/AdminPanelView.php
$output[] = ' <input type="text" id="preview_simulateDate" name="TSFE_ADMIN_PANEL[preview_simulateDate]_hr" onchange="TSFEtypo3FormFieldGet(' . GeneralUtility::quoteJSvalue('TSFE_ADMIN_PANEL[preview_simulateDate]') . ', "datetime", "", 1,0);" />';
This code leads to wrong JavaScript code in the Admin Panel (see the mixed up quotes for call to TSFEtypo3FormFieldGet ) and a JavaScript error in onChange:
<div class="typo3-adminPanel-form-group">
<label for="preview_simulateDate"> Simulate time </label>
<input type="text" id="preview_simulateDate" name="TSFE_ADMIN_PANEL[preview_simulateDate]_hr"
onchange="TSFEtypo3FormFieldGet('TSFE_ADMIN_PANEL[preview_simulateDate]', "datetime", "", 1,0);" />
<input type="hidden" name="TSFE_ADMIN_PANEL[preview_simulateDate]" value="1522195200" />
</div>
The corrected code should read either
// remove obsolete call to GeneralUtility::quoteJSvalue
$output[] = ' <input type="text" id="preview_simulateDate" name="TSFE_ADMIN_PANEL[preview_simulateDate]_hr"
onchange="TSFEtypo3FormFieldGet(\'TSFE_ADMIN_PANEL[preview_simulateDate]\', \'datetime\', \'\', 1,0);" />';
or
// keep call to GeneralUtility::quoteJSvalue but fix the remaining quotes for TSFEtypo3FormFieldGet
$output[] = ' <input type="text" id="preview_simulateDate" name="TSFE_ADMIN_PANEL[preview_simulateDate]_hr"
onchange="TSFEtypo3FormFieldGet(' . GeneralUtility::quoteJSvalue('TSFE_ADMIN_PANEL[preview_simulateDate]') . ', \'datetime\', \'\', 1,0);" />';
Updated by Gerrit Code Review over 6 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56461
Updated by Gerrit Code Review over 6 years ago
Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56462
Updated by Gerrit Code Review over 6 years ago
Patch set 2 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56462
Updated by Andreas Kienast over 6 years ago
- Related to Bug #83357: Add missing htmlspecialchars() calls in frontend/Classes/View/AdminPanelView.php added
Updated by Sascha Löffler over 6 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 787fbedbcb0f2c5ca652b8c7e4c2a122683a0be5.