Review main Merged

89774[BUGFIX] Ensure FlexFormTools reset state of injected TcaMigration

Garvin Hicking CR +2 V +2 Easy +43 −1 updated 06/23/25, 10:50

Commit message

With #104268, `TcaMigration` is injected as a service into
`FlexFormTools` under the assumption that it is stateless.

However, the `$messages` property actually carries state and will
unnecessarily stack output messages from further runs.

This patch ensures the message stack gets reset on each run
of the `migrate()` method so the class can act as a proper
dependency-injected pseudo-stateless service.
An added test simulates this logic.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Benjamin Franzke +1
    • Oli Bartsch +1
    • Markus Klein +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Benjamin Franzke +1
    • Oli Bartsch +1
    • core-ci +1 CI

Issues 2

Files 3

Review log 1621

  1. Garvin Hicking uploaded patch set 1 06/19/25, 08:31

  2. Garvin Hicking uploaded patch set 2 06/19/25, 08:33

  3. core-ci voted on patch set 1 V -1 06/19/25, 08:38 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80496

  4. core-ci voted on patch set 2 V +1 06/19/25, 08:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80497

  5. Oliver Klee updated the commit message in patch set 3 V +1 06/19/25, 10:48

  6. core-ci voted on patch set 3 V +1 06/19/25, 10:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80500

  7. Benjamin Franzke commented on patch set 3 CR -1 06/19/25, 11:05

    TcaMigration.php:112

    I tried to google this word, synonyms like "concise" do not fit into this context. Taking the context into account I think you mean "successive" or "consecutive"?

    TcaMigration.php:118

    I'd prefer to initialize messages to an empty array within `migrate()`, there is no good usecase where multiple `migrate()` calls should "collect" messages… This ensures that this "mistake" does not happen again, when `TcaMigration` is used as a service. And `getMessage()` is annotated with "Can be used for deprecation messages after migrate() was called", that means it's clear the messages should refer to the last migration. (And of course it would have been better to return the messages as a result of `migrate()`, but that's another story…)
  8. Garvin Hicking commented on patch set 3 06/19/25, 12:00

    TcaMigration.php:112 Reply

    Yes, auto-spelling complete got to me. I meant successive, thanks.

    TcaMigration.php:118 Reply

    Understood. I was not sure of possible scenarios this collection might be wanted. I can rework this and adapt tests.
  9. Garvin Hicking uploaded patch set 4 CR -1 V +1 06/19/25, 18:50

  10. core-ci voted on patch set 4 V -1 06/19/25, 18:58 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80506

  11. Garvin Hicking uploaded patch set 5 V -1 06/19/25, 19:00

  12. Garvin Hicking commented on patch set 5 06/19/25, 19:03

    Reworked patch. Logged deprecations before and after the patch can be viewed here: https://gist.github.com/garvinhicking/e10e07f0e40dccdda726c8b61b505cff

    TcaMigration.php:112 Reply

    Done

    TcaMigration.php:118 Reply

    Done
  13. core-ci voted on patch set 5 V +1 06/19/25, 19:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80507

  14. Markus Klein voted on patch set 5 CR +1 06/20/25, 05:44

  15. Benjamin Franzke voted on patch set 5 CR +1 V +1 06/20/25, 07:32

  16. Oli Bartsch commented on patch set 5 06/20/25, 08:26

    Can we not just make the service non shared? `#[Autoconfigure(public: true, shared: false)]`
  17. Garvin Hicking commented on patch set 5 06/20/25, 09:08

    Reply

    No, because the FlexFormTools service re-uses the single service. It's not about other injection cases that let the messages bleed, but reuse of the same instance. So the other way would only be to remove the class from being injected at all, and use a "GU:mI()" every time.
  18. Oli Bartsch commented on patch set 5 CR +1 V +1 06/23/25, 09:22

    Reply

    ACK
  19. Christian Kuhn voted on patch set 5 CR +2 V +2 06/23/25, 10:05

  20. Christian Kuhn commented on patch set 5 06/23/25, 10:20

    my bad. i should have seen this with #104268
  21. Christian Kuhn merged patch set 6 06/23/25, 10:50