Project

General

Profile

Actions

Bug #95181

open

FlexForm – String returned for empty sections instead of Array

Added by Pierrick Caillon about 3 years ago. Updated about 2 years ago.

Status:
Needs Feedback
Priority:
Should have
Assignee:
-
Category:
-
Start date:
2021-09-10
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.3
Tags:
flexform, tceform, frontend
Complexity:
medium
Is Regression:
Sprint Focus:

Description

When using the section feature of FlexForm, and empting a section, the result parsed flexform will contain an empty string instead of an empty array.
This behaviour existed before the introduction of FlexFormService.

To reproduce, a contributor must remove all elements in a flexform section and save. The flexform will then contain:

                <field index="my_field">
                    <el index="el"></el>
                </field>

In EXT:core/Classes/Service/FlexFormService.phpL49, when discovering a node named el, the parser is recursively called. When $nodeValue is an empty string, it should return an empty array. Not doing so force developers to test again empty, which can not always be done straightforwardly. It is expected to be able to test with count().

I attached an example flexform to test with.


Files

flexform.xml (821 Bytes) flexform.xml Exemple flexform Pierrick Caillon, 2021-09-10 14:39
FlexFormService.patch (962 Bytes) FlexFormService.patch The patch Pierrick Caillon, 2021-09-10 14:39
unexpected result after changes.mp4 (2.54 MB) unexpected result after changes.mp4 Bug display video Pierrick Caillon, 2022-05-24 17:19
temp.zip (1.88 KB) temp.zip Temporary extension with TCA configuration Pierrick Caillon, 2022-05-24 17:20
Actions

Also available in: Atom PDF