Project

General

Profile

Actions

Bug #84524

closed

SimulateDate in Preview not working in 8.7.11

Added by Tim Horstmann over 6 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Must have
Category:
Frontend
Target version:
-
Start date:
2018-03-23
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.0
Tags:
Complexity:
easy
Is Regression:
Yes
Sprint Focus:

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.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #83357: Add missing htmlspecialchars() calls in frontend/Classes/View/AdminPanelView.phpClosedStephan Großberndt2017-12-16

Actions
Actions #1

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);" />';
Actions #2

Updated by Sascha Löffler over 6 years ago

  • Assignee set to Sascha Löffler
Actions #3

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

Actions #4

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

Actions #5

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

Actions #6

Updated by Andreas Kienast over 6 years ago

  • Related to Bug #83357: Add missing htmlspecialchars() calls in frontend/Classes/View/AdminPanelView.php added
Actions #7

Updated by Sascha Löffler over 6 years ago

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

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF