Project

General

Profile

Actions

Bug #103168

closed

High index for custom template paths causes browser freezes in the Backend Form Editor

Added by Steffen Keuper 9 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Form Framework
Target version:
-
Start date:
2024-02-21
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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.

Actions #1

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?

Actions #2

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;
  },
  {}
);

Actions #3

Updated by Andreas Kienast 9 months ago

Thanks, this helps a lot.

Actions #4

Updated by Andreas Kienast 9 months ago

  • Status changed from Needs Feedback to Accepted
Actions #5

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

Actions #6

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?

Actions #7

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.

Actions #8

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

Actions #9

Updated by Anonymous 9 months ago

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

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

Actions #11

Updated by Anonymous 9 months ago

  • Status changed from Under Review to Resolved
Actions #12

Updated by Benni Mack 5 months ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF