Review main Merged

85669[TASK] Do not use ConfigurationManager in FormPersistenceManager

Christian Kuhn CR +2 V +2 Nightmare +1589 −1802 updated 08/20/24, 09:02

Commit message

The FormPersistenceManager is a central class of ext:form
that takes care of .form.yaml writing and loading. This
includes overloading with form specific TypoScript settings
and sanitation of storage locations based on module.tx_form
TypoScript.

Since ext:form is designed as an extbase extension,
FormPersistenceManager relies on extbase ConfigurationManager
to retrieve TypoScript. The ext:form internal own variant
of extbase ConfigurationManager has this dependency as well.

This wouldn't be a huge problem if FormPersistenceManager
is only used from within the extbase bootstrapped extension
context only. FormPersistenceManager however is used
'out-of-context' in three places: It is used within the
BE FormEngine related flex form data structure handling
hook, within the BE page module related content element
preview rendering, and by the formvh:render view helper.

These three places do not have an extbase context, so extbase,
and especially the extbase related stateful injectable singleton
ConfigurationManager, has not been configured at these points.
Extbase ConfigurationManager, and in turn the ext:form extended
variant as well, have a dependency to the request to work
properly and thus rely on the request being set up correctly.

To deal with this, FormPersistenceManager configures extbase
ConfigurationManager within __construct() by handing over the
request from $GLOBALS['TYPO3_REQUEST'].

This is bad for a series of reasons, one being obviously the
access to $GLOBALS['TYPO3_REQUEST'] within __construct() in
the first place. Also, FormPersistenceManager is quite often
used *within* properly configured extbase context as well,
for instance from within the extbase based ext:form
controllers, so FormPersistenceManager then reconfigures
extbase ConfigurationManager with the (non-extbase) global
request and thus messes up its state.

The problem is here that FormPersistenceManager does not and
can not know wether its used 'out-of-context'.

To deal with this, the patch removes use of ConfigurationManager
to retrieve TypoScript within FormPersistenceManager, and forces
consumers to hand it over to those methods that need it. The
idea is that only the callers know their context and can take
care of setting up ConfigurationManager as needed on their own.

This approach makes the dependency to the request object
explicit: Two of the three 'out-of-context' places are "ok" with
that: The BE page module preview rendering has the request
available, the formvh:render view helper as well. The third
one will be harder to resolve: The flex form related data
structure handling has not been designed to have the request,
there may or may not be CLI situations in this low level handling
where no request is available. This needs further analysis, the
patch outlines various options for now.

The patch forces FormPersistenceManagerInterface to be adapted,
which should not be a huge issue since the overall functionality
is ext:form internal, and there shouldn't be extensions that
use it directly. The patch is thus *not* considered breaking
and FormPersistenceManagerInterface is now declared @internal
along the way to reflect this.

Also, as usual when working in this area, the related tests
receive an overhaul to deal with the new signatures and
internal handling, and to be more easy to maintain.

Also, class ext:form ConfigurationService suffers from
similar issues as outlined above and will probably need
a revamp as well. This one however is only used in
combination with FormPersistenceManager when used
'out-of-context', so the changes for FormPersistenceManager
relax this situation as well. Still, and @todo is left in it.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Anja Leichsenring +1
    • Stefan Bürk +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Anja Leichsenring +1
    • Stefan Bürk +1
    • core-ci +1 CI

Issues 3

Files 21

Show 1 more file

Review log 2954

Show 1629 earlier messages
  1. Christian Kuhn uploaded patch set 1 08/17/24, 10:53

  2. core-ci voted on patch set 1 V -1 08/17/24, 10:59 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/63639

  3. Christian Kuhn uploaded patch set 2 V -1 08/17/24, 12:47

  4. Christian Kuhn uploaded patch set 3 08/17/24, 12:50

  5. core-ci voted on patch set 2 V -1 08/17/24, 12:56 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/63655

  6. core-ci voted on patch set 3 V -1 08/17/24, 12:58 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/63656

  7. Christian Kuhn uploaded patch set 4 V -1 08/17/24, 13:02

  8. core-ci voted on patch set 4 V -1 08/17/24, 13:11 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/63658

  9. Christian Kuhn uploaded patch set 5 V -1 08/18/24, 09:52

  10. core-ci voted on patch set 5 V -1 08/18/24, 10:02 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/63697

  11. Christian Kuhn uploaded patch set 6 V -1 08/18/24, 13:27

  12. core-ci voted on patch set 6 V -1 08/18/24, 13:35 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/63705

  13. Christian Kuhn uploaded patch set 7 V -1 08/18/24, 13:54

  14. core-ci voted on patch set 7 V -1 08/18/24, 14:01 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/63706

  15. Christian Kuhn uploaded patch set 8 V -1 08/18/24, 14:03

  16. core-ci voted on patch set 8 V -1 08/18/24, 14:11 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/63707

  17. Christian Kuhn uploaded patch set 9 V -1 08/18/24, 14:27

  18. Christian Kuhn uploaded patch set 10 08/18/24, 14:29

  19. Christian Kuhn uploaded patch set 11 08/18/24, 14:35

  20. core-ci voted on patch set 9 V -1 08/18/24, 14:38 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/63709

  21. core-ci voted on patch set 10 V -1 08/18/24, 14:38 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/63710

  22. core-ci voted on patch set 11 V -1 08/18/24, 14:48 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/63711

  23. Christian Kuhn uploaded patch set 12 V -1 08/18/24, 14:51

  24. Christian Kuhn uploaded patch set 13 08/18/24, 14:58

  25. core-ci voted on patch set 12 V -1 08/18/24, 15:00 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/63716

  26. core-ci voted on patch set 13 V -1 08/18/24, 15:06 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/63718

  27. Christian Kuhn uploaded patch set 14 V -1 08/18/24, 15:24

  28. Christian Kuhn uploaded patch set 15 08/18/24, 15:27

  29. Christian Kuhn uploaded patch set 16 08/18/24, 15:29

  1. core-ci voted on patch set 14 V -1 08/18/24, 15:30 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/63721

  2. core-ci voted on patch set 15 V -1 08/18/24, 15:30 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/63722

  3. core-ci voted on patch set 16 V -1 08/18/24, 15:34 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/63723

  4. Christian Kuhn uploaded patch set 17 V -1 08/19/24, 07:47

  5. Christian Kuhn uploaded patch set 18 08/19/24, 07:52

  6. core-ci voted on patch set 17 V -1 08/19/24, 07:54 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/63753

  7. core-ci voted on patch set 18 V +1 08/19/24, 07:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/63754

  8. Christian Kuhn uploaded patch set 19 V +1 08/20/24, 07:36

  9. core-ci voted on patch set 19 V +1 08/20/24, 07:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/63808

  10. Christian Kuhn uploaded patch set 20 V +1 08/20/24, 07:52

  11. core-ci voted on patch set 20 V +1 08/20/24, 07:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/63809

  12. Christian Kuhn updated the commit message in patch set 21 V +1 08/20/24, 08:07

  13. core-ci voted on patch set 21 V -1 08/20/24, 08:16 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/63810

  14. core-ci voted on patch set 21 V +1 08/20/24, 08:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/63810

  15. Christian Kuhn uploaded patch set 22 V +1 08/20/24, 08:32

  16. Christian Kuhn uploaded patch set 23 08/20/24, 08:38

  17. Christian Kuhn uploaded patch set 24 08/20/24, 08:39

  18. core-ci voted on patch set 22 V +1 08/20/24, 08:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/63814

  19. core-ci voted on patch set 23 V +1 08/20/24, 08:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/63816

  20. core-ci voted on patch set 24 V +1 08/20/24, 08:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/63817

  21. Stefan Bürk voted on patch set 24 CR +1 08/20/24, 08:55

  22. Anja Leichsenring voted on patch set 24 CR +1 V +1 08/20/24, 08:58

  23. Stefan Bürk voted on patch set 24 V +1 08/20/24, 08:59

  24. Christian Kuhn voted on patch set 24 CR +2 V +2 08/20/24, 09:02

  25. Christian Kuhn merged patch set 25 08/20/24, 09:02