Issue Bug New

#105133FlexFormProcessor do not attach data correctly in processAdditionalDataProcessors

Maxime Lafontaine 09/26/24, 15:32 updated 11/09/26, 13:52

Description

In the FlexFormProcessor, the data is added to an array before passing it to the CObj start method.

$contentObjectRenderer->start([$data]);
Should be
@$contentObjectRenderer->start($data);@

Else the sub-processor need to get the data from the first element of the array, and not directly.
That can work with DatabaseQueryProcessor (my case) with, per example, uidInList.data = field : 0|my_flexform_field .
But is a problem for the processors using only “fieldName”, as CommaSeparatedValueProcessor

Reviews 1

Fix this issue

Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". The changes above were merged or abandoned: read them before you start. How to create a patch

Commit message
[BUGFIX] FlexFormProcessor do not attach data correctly in processAdditionalDataProcessors Resolves: #105133 Releases: main

History 46

  1. Garvin Hicking commented and changed status Under Review Needs Feedback <span data-processor="relativetime" data-value="2024-09-26T18:30:28+00:00" > 09/26/24, 18:30 </span>

    I’ve tried your patch suggestion and the tests will actually report that this leads to consequences where expectations are no longer met:

    https://git.typo3.org/typo3/CI/cms/-/jobs/3803169

    Maybe that helps you to further work on a patch/investigation?

  2. Garvin Hicking commented <span data-processor="relativetime" data-value="2024-09-26T18:31:19+00:00" > 09/26/24, 18:31 </span>

    Copied here in case the test artifacts get removed:

    There were 2 failures:
    1) TYPO3\CMS\Frontend\Tests\Unit\DataProcessing\FlexFormProcessorTest::subDataProcessorIsResolved
    Expectation failed for method name is "start" when invoked 1 time
    Parameter 0 for invocation TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::start([...], '') does not match expected value.
    Failed asserting that two arrays are equal.
    --- Expected
    +++ Actual
    @@ @@
     Array (
    -    0 => [...]
    +    'options' => [...]
     )
    /builds/typo3/CI/cms/typo3/sysext/frontend/Classes/DataProcessing/FlexFormProcessor.php:140
    /builds/typo3/CI/cms/typo3/sysext/frontend/Classes/DataProcessing/FlexFormProcessor.php:101
    /builds/typo3/CI/cms/typo3/sysext/frontend/Tests/Unit/DataProcessing/FlexFormProcessorTest.php:214
    /builds/typo3/CI/cms/bin/phpunit:122
    2) TYPO3\CMS\Frontend\Tests\Unit\DataProcessing\FlexFormProcessorTest::subDataProcessorIsResolved
    tearDown() integrity check found left over instances in GeneralUtility::makeInstance() instance list. Always consume instances added via GeneralUtility::addInstance() in your test by the test subject.
    Failed asserting that two arrays are equal.
    --- Expected
    +++ Actual
    @@ @@
     Array (
    +    0 => MockObject_ContentDataProcessor_ee0aac71 Object (...)
     )
    /builds/typo3/CI/cms/vendor/typo3/testing-framework/Classes/Core/Unit/UnitTestCase.php:180
    /builds/typo3/CI/cms/bin/phpunit:122
    FAILURES!
    Tests: 11721, Assertions: 49873, Failures: 2.
  3. Gerrit Code Review pushed patch set 2 for main to change 86350 status Needs Feedback Under Review <span data-processor="relativetime" data-value="2024-10-18T14:03:09+00:00" > 10/18/24, 14:03 </span>

  4. Maxime Lafontaine commented <span data-processor="relativetime" data-value="2024-11-02T12:44:32+00:00" > 11/02/24, 12:44 </span>

    Yes, the change break the test because the test display exactly the problem:
    The data of the flexform is added to an array as the first (0) element.
    The array should be the flexform data. I’m not sure what was the idea to put it in the array, but it break the chaining of processors.
    With the DatabaseQueryProcessor I have make it work since I could transform the data used (has display in the bug description), but will not work for other processors that take the data directly (those that use a fieldName as CommaSeparatedValueProcessor for example).
    Maybe we can add a property to change the behaviour, or just have it in the array (like now) AND merge it with the flexform data, if really needed.
    Yes, it’s a breaking change to how it work now.