Project

General

Profile

Actions

Bug #98607

closed

PHP Warning: Undefined array key "el" in /var/www/html/web/typo3/sysext/core/Classes/Configuration/FlexForm/FlexFormTools.php line 802

Added by Johannes Przymusinski almost 2 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2022-10-13
Due date:
% Done:

100%

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

Description

This happens when saving a FlexForm configuration in a custom frontend plugin.

I'd work on this and contribute a fix later

Actions #1

Updated by Chris Müller almost 2 years ago

The structure of the FlexForm XML would be interesting.

Actions #2

Updated by Stefan Bürk almost 2 years ago

Looking at that line, this means that you have a DataStructure without a root sheet element. But yeah, this is not properly guarded:

v11 FlexFormTools L802 should be:

if (is_array($sheetData['ROOT']) && is_array($sheetData['ROOT']['el'] ?? null)) {

as we are doing fixed from main with backport's, patch should be created against main, where this should be FlexFormTools L800 instead.

Then it would not crash and properly output the else-branch message:

return 'Data Structure ERROR: No ROOT element found for sheet "' . $sheetKey . '".';

Won't push a patch for now - ping me on slack if you have trouble to provide a patch, and I will push one than.

Actions #3

Updated by Gerrit Code Review almost 2 years ago

  • Status changed from New 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/+/76119

Actions #4

Updated by Gerrit Code Review almost 2 years ago

Patch set 2 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/+/76119

Actions #5

Updated by Johannes Przymusinski [jop-software.de] almost 2 years ago

Thanks for your feedback Stefan.

I've just pushed a patch against main.
What would be the workflow to backport this to 11.5?
Sorry for the propably stupid question, those are my first steps into TYPO3 Core contributions :-)


Also in case anyony reading this is interested, I found out what caused the issue in the first place.
I haven't written the XML Code myself, but it propably was a bad copy-past from main docs into a v11 project.

<T3DataStructure>
    <meta>
        <langDisable>1</langDisable>
    </meta>
    <sheets>
        <sDEF>
            <ROOT>
                <TCEforms>
                    <type>array</type>
                    <el>
                        <settings.slide_interval>
                            <label>--redacted--</label>
                            <config>
                                <type>input</type>
                            </config>
                        </settings.slide_interval>
                    </el>
                </TCEforms>
            </ROOT>
        </sDEF>
    </sheets>
</T3DataStructure>

From my understanding, the extra `TCEforms` tag prevented the FlexFormTools to access the `el` tag inside of `ROOT` which then causes the undefined array key error.

Actions #6

Updated by Stefan Bürk almost 2 years ago

Johannes Przymusinski wrote in #note-5:

Thanks for your feedback Stefan.

I've just pushed a patch against main.
What would be the workflow to backport this to 11.5?
Sorry for the propably stupid question, those are my first steps into TYPO3 Core contributions :-)

There are no stupid question. Better ask twice or more before bad things is always a good advice. Generally spoken, if you provide a bugfix which needs to be backported you do not have to take care of them. Just create the bugfix for main and add the versions which it should be backported after the review process. Core Mergers are responsible for doing the backports when the merges a patch.

This is generally a "cherry pick" of the patch on the backport branch then, with eventually adjustments needed.

Just so in the patch that I looked up the wrong Line Number for main branch ;) Sorry about that ....

From my understanding, the extra `TCEforms` tag prevented the FlexFormTools to access the `el` tag inside of `ROOT` which then causes the undefined array key error.

V12 removed that from flexform structure, so you may take this as a "notice" for preparing for v12 upgrades, see https://docs.typo3.org/c/typo3/cms-core/main/en-us//Changelog/12.0/Breaking-97126-RemoveTCEformsArrayKeyInFlexForm.html

V11 already removed it in the calling chain, as v12 fully removes it at all.

Actions #7

Updated by Gerrit Code Review almost 2 years ago

Patch set 3 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/+/76119

Actions #8

Updated by Johannes Przymusinski [jop-software.de] almost 2 years ago

Core Mergers are responsible for doing the backports when the merges a patch.

So I basically did my job with "back porting" the change by "setting" the `Releases` to `main, 11.5` in my case.

No worries about the wrong line number, I could have spottet that my self :D
In the first investigation into the error message I stumbled across the same L802 until I realized that I was viewing the `main` code on GitHub and not `11.5`

Thank you for the updated patch :)

Also thanks for the explanation about flexforms.

V11 already removed it in the calling chain, as v12 fully removes it at all.

Thank you, we've removed the `TCEforms` which fixed the issue from what I know.
(I'm not working actively on the project, just happend to handle the bug report since the colleague who stumbled over this is in a sprint and asked me for help)

Actions #9

Updated by Gerrit Code Review almost 2 years ago

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/+/76070

Actions #10

Updated by Johannes Przymusinski [jop-software.de] almost 2 years ago

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

Updated by Benni Mack over 1 year ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF