Bug #103168
closedHigh index for custom template paths causes browser freezes in the Backend Form Editor
100%
Description
We use the current timestamp mostly for new template overrides to avoid accidental overlaps. While this works perfectly fine in TYPO3 it caused unexpected browser freezes in the backend form editor due to the parsing of the YAML file in JavaScript.
Example setup:
renderingOptions:
submitButtonLabel: Submit
type: Form
identifier: test_1
label: test
prototypeName: standard
finishers:
-
options:
subject: Test
recipients:
test@test.com: ''
senderAddress: test@test.com
senderName: ''
addHtmlPart: true
attachUploads: true
title: ''
templateName: 'Test{@format}.html'
templateRootPaths:
1708504268: 'EXT:forms_extended/Resources/Private/Emails/Templates'
partialRootPaths:
1708504268: 'EXT:forms_extended/Resources/Private/Emails/Partials'
identifier: EmailToSender
renderables:
-
renderingOptions:
previousButtonLabel: back
nextButtonLabel: next
type: Page
identifier: page-1
label: Step
This is caused by the usage of the reduce function on the JavaScript array in the core.js of the Backend Form Editor:
obj[firstPartOfPath] = obj[firstPartOfPath].reduce(
function(converted, item, itemIndex) {
converted[itemIndex] = item;
return converted;
},
{}
);
This part causes JavaScript to go through all array cells, which with the current timestamp amount to 1.7 billion entries, causing the browser to freeze for multiple seconds.
The frontend works completely normal, only the Form Editor is affected by high template indexes.
Updated by Andreas Kienast 9 months ago
- Status changed from New to Needs Feedback
Thank you for your report. Can you please tell which concrete TYPO3 version and which browser you're using?
Updated by Steffen Keuper 9 months ago
Andreas Kienast wrote in #note-1:
Thank you for your report. Can you please tell which concrete TYPO3 version and which browser you're using?
I tested it the TYPO3 versions v12.4.11 and v11.5.36.
From browsers I tested it in Firefox (122.0.1), Chrome (122.0.6261.58 (Official Build) (64-bit)) and Edge (121.0.2277.128 (Official build) (64-bit))
The problem can also get simplified into this JavaScript snippet:
test = [];
test[1708504268] = 'EXT:forms_extended/Resources/Private/Emails/Templates';
test.reduce(
function(converted, item, itemIndex) {
converted[itemIndex] = item;
return converted;
},
{}
);
Updated by Andreas Kienast 9 months ago
- Status changed from Needs Feedback to Accepted
Updated by Gerrit Code Review 9 months ago
- Status changed from Accepted to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83058
Updated by Benjamin Franzke 9 months ago · Edited
We pushed a fix to https://review.typo3.org/c/Packages/TYPO3.CMS/+/83058 – please test.
Btw, we could only reproduce the issue by trying to create an additional finisher via the FormEditor GUI.
The issue did not happen immediately when opening the FormEditor with this configuration applied (that's why we couldn't reproduce it and asked for more details). Can you confirm that?
Updated by Steffen Keuper 9 months ago
Benjamin Franzke wrote in #note-6:
We pushed a fix to https://review.typo3.org/c/Packages/TYPO3.CMS/+/83058 – please test.
Btw, we could only reproduce the issue by trying to create an additional finisher via the FormEditor GUI.
The issue did not happen immediately when opening the FormEditor with this configuration applied (that's why we couldn't reproduce it and asked for more details). Can you confirm that?
Ah I completely forgot to mention that. It occurred on every newly added element to the form (finishers or normal form elements).
I just tested the patch and it fixed it for me.
Updated by Gerrit Code Review 9 months ago
Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83079
Updated by Anonymous 9 months ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 01b133b00bc4034e79c693d0712e75917233d7d0.
Updated by Gerrit Code Review 9 months ago
- Status changed from Resolved to Under Review
Patch set 1 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83082
Updated by Anonymous 9 months ago
- Status changed from Under Review to Resolved
Applied in changeset 4e44ae83ee97c5c5b1e7a17b7a7a846dfe8c774a.