#95181FlexForm – String returned for empty sections instead of Array
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.
Reviews 2
Files 4
History 811
-
Mathias Schreiber changed Sprint Focus Remote Sprint <span data-processor="relativetime" data-value="2022-03-08T12:09:18+00:00" > 03/08/22, 12:09 </span>
-
Larry Garfield commented and changed status
NewNeeds Feedback <span data-processor="relativetime" data-value="2022-04-12T16:56:43+00:00" > 04/12/22, 16:56 </span> -
Pierrick Caillon commented <span data-processor="relativetime" data-value="2022-04-13T16:19:20+00:00" > 04/13/22, 16:19 </span>
It is not when a section is declared empty in the datastructure. But after removing all elements from a declared section in a flexform instance.
-
Pierrick Caillon commented and changed attached unexpected result after changes.mp4 attached temp.zip <span data-processor="relativetime" data-value="2022-05-24T17:24:16+00:00" > 05/24/22, 17:24 </span>
I have created the smallest possible extension to provide necessary configuration.
In the attached video, I illustrate the reproduction steps using this extension.Should I also illustrate transformation service in frontend?
(Reproduction done using main (e97def2559e6185392d2f3089c51ced2e740327a))
-
Susanne Moog changed Complexity
no-brainermedium Sprint FocusRemote SprintOn Location Sprint <span data-processor="relativetime" data-value="2022-08-05T12:59:52+00:00" > 08/05/22, 12:59 </span> -
Oliver Hader changed Sprint Focus
On Location Sprint<span data-processor="relativetime" data-value="2022-11-03T09:04:24+00:00" > 11/03/22, 09:04 </span> -
Gerrit Code Review pushed patch set 1 for main to change 97476 status
Needs FeedbackUnder Review <span data-processor="relativetime" data-value="2026-11-09T21:11:30+00:00" > 11/09/26, 21:11 </span> -
Gerrit Code Review pushed patch set 1 for 14.3 to change 97494 <span data-processor="relativetime" data-value="2026-11-10T06:01:27+00:00" > 11/10/26, 06:01 </span>
-
Benni Mack commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2026-11-10T06:05:10+00:00" > 11/10/26, 06:05 </span>Applied in changeset commit:0d9a43f713f98999137f7d04d326bf5fe24cadde.
-
Gerrit Code Review pushed patch set 2 for 14.3 to change 97494 status
ResolvedUnder Review <span data-processor="relativetime" data-value="2026-11-10T06:24:42+00:00" > 11/10/26, 06:24 </span> -
Benni Mack commented and changed status
Under ReviewResolved <span data-processor="relativetime" data-value="2026-11-10T06:45:14+00:00" > 11/10/26, 06:45 </span>Applied in changeset commit:5aa4423355950612b94dcf9ae00dac7974e618a4.
Hi Pierrick. I’m trying to turn your examples into a test so I can make a patch for this, but I’m not entirely clear on it. There’s no empty section in the XML you provided, is there?
When I run it through a test (after adding a “data” element wrapper around “sheets”, and adding index attributes to sheets and sDEF to avoid parse errors), I get the same result back both with and without your patch.
Can you clarify, perhaps with a confirmed test case?
(I’m testing on `main` currently, so the future v12.)