Review main Merged

89710[BUGFIX] Let AbstractListTypeToCTypeUpdate wizard handle edge cases

Garvin Hicking CR +2 V +2 Hard +406 −13 updated 06/23/25, 09:01

Commit message

Two bugs are fixed in the (abstract) migration wizard that converts
list_type plugins to CType (see #105076) which should mainly
effect edge cases:

1. Allow list_type elements with integer based keys
===================================================

PHP arrays defined like:

```
return [
  '1' => 'pi1_new',
  '2' => 'pi2_new',
];
```

will be handleded by PHP internally as having integer array keys.

Thus, the type checking and exception handling in later usages
will fail if such keys are used (like for extensions such as
EXT:tt_board).

The wizard now takes this into account.

2. Properly migrate be_groups.explicit_allowdeny when
   "old" name (list_type) does NOT match "new" name (CType)
===========================================================

The old code only could migrate the be_groups.explicit_allowdeny,
when CType and list_type were identical.

This is now fixed to properly take the "old" name into account.

Other changes:
==============

Tests are added to verify both behaviours with a new custom
migration implementation. The old "indexedsearch" based
migration only used the same key for CType and list_type,
and could not catch this scenario. Another test ensures
the `validateRequirements()` exceptions are thrown on
invalid configurations. The PHPStan baseline entry is removed
thanks to the removal of the unneeded narrowed check.

The exception message is enhanced to also contain the
name of the wizard for better identification.

Note though that for "readable" list_type names it is
common practice to have the CType be named the same,
and thus this bug should hopefully not affect too many
installations. Also, using integer keys for list_types
should not be broadly used (anymore).

Review

  • Code review CR +2 Done
    • Garvin Hicking +2
    • Oli Bartsch +1
    • Torben Hansen +1
    • Stefan Bürk +1
  • Verified V +2 Done
    • Garvin Hicking +2
    • Oli Bartsch +1
    • Torben Hansen +1
    • Stefan Bürk +1
    • core-ci +1 CI

Issues 3

Files 11

Review log 2025

  1. Garvin Hicking uploaded patch set 1 06/12/25, 07:29

  2. Garvin Hicking commented on patch set 1 CR -1 06/12/25, 07:32

    Working on tests to verify the fix, indexedsearch_pi2 migration is not suitable here
  3. core-ci voted on patch set 1 V -1 06/12/25, 07:36 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80235

  4. Garvin Hicking uploaded patch set 2 CR -1 V -1 06/12/25, 08:17

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

  6. Garvin Hicking uploaded patch set 3 V -1 06/12/25, 08:51

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

  8. Franz Holzinger commented on patch set 3 06/12/25, 09:03

    The Exception messages should be improved and add the title of the specific upgrade wizard: $this->getTitle()
  9. Garvin Hicking marked it work in progress 06/12/25, 09:15

  10. Garvin Hicking marked it ready for review 06/13/25, 07:25

  11. Garvin Hicking uploaded patch set 4 V -1 06/13/25, 07:25

  12. core-ci voted on patch set 4 V +1 06/13/25, 07:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80275

  13. Franz Holzinger commented on patch set 4 CR -1 06/13/25, 09:48

    "'someoldplugin_pi2' => 'somenewplugin_pi2'," This is wrong. The plugin remains the same. There is no new plugin. It is just a conversion of from list_type to CType of the same plugin as before.
  14. Garvin Hicking commented on patch set 4 06/13/25, 10:21

    Reply

    I think the classname

    Reply

    No, this is alright. You can actually rename plugins, this is a "feature" the migration wizard supports. But extension authors of course then need to register the "new name".
  15. Garvin Hicking commented on patch set 4 06/13/25, 10:22

    Reply

    (otherwise the array would not need a key->value mapping but only a value)
  16. Stefan Bürk commented on patch set 4 06/13/25, 11:44

    Reply

    > "'someoldplugin_pi2' => 'somenewplugin_pi2'," > > This is wrong. The plugin remains the same. There is no new plugin. It is just a > conversion of from list_type to CType of the same plugin as before. Maybe in your use-case that is not needed. I can tell you that we took the oppurtunity to migrate list_type to CType to also rename plugins in projecets and even projects. As we already doing that in v11 or v12 we used a own upgrade wizard for that (special in public extensions) instead of using the TYPO3 shipped one. And that more than one time, so it's a legit assumption. If it does not change simply use the same value on left and right side (old list_type => new CType). Beside that, I'm curious why you put a -1 on it and saying that is wrong, as this is exactly what is required to fix the issue reported by you in #106870 to rename from old "list_type (int)1" to "new CType (string)some_plugin_name". Can you please reconsider and rethink your opionion on that and remove the -1, please ?
  17. Stefan Bürk commented on patch set 4 06/13/25, 11:52

    AbstractListTypeToCTypeUpdate.php:242

    I'd would personally drop the `getContentElementsToUpdate()` method completly and rework the update command. Currently, all "records" are selected and returned (one roundtrip), iterated and for each element a update command triggerd (count elements extra roundtrips per update query). That means, memory consumption is here also an issue. Even worser, getContentElements() did not returned the result set which keeps items until fetchin outside the php memory scope (limit) but instead fetched all seceted items and passed it as array (consuming the memory for all records). Update is here done using simply plain update query, not using DataHandler and therefor skipng audit logs (record change history) anyway and could be reworked to dispatch one update query to update all content elements of old list_type to new CType in one updatae query (1 sql query roundtrip instead of eventually hundred or thousands or more). I know, unrelated to that change. @garvin@hick.ing do you think it would make sense to consider that here too as we are now on the abstract and changeing stuff ?
  18. Garvin Hicking commented on patch set 4 06/13/25, 17:13

    AbstractListTypeToCTypeUpdate.php:242 Reply

    I do think that would be an approach worth to discuss. But I'd rsther like to approach this in its own follow-up patch. Then we would have tests in place and the review of both this, and the follow-up patch would be easier. We also need to think if that could break existing implementations of the abstract, I wouldn't want to enforce the "protected method = internal" policy here to not annoy third parties. I already am not a fan that this patch here fixes two issues at once, but separating that would be time consuming and possibly harder to wrap up quickly. Would you be okay to leave it at "just" fixing the teo bugs here?
  19. Oli Bartsch uploaded patch set 5 CR -1 V +1 06/23/25, 08:22

  20. Oli Bartsch commented on patch set 5 CR +1 V +1 06/23/25, 08:23

    Reply

    Like already mentioned, all ways are supported "old" => "new" as well as "old" to "old", see corresponding tests.

    AbstractListTypeToCTypeUpdate.php:242 Reply

    Yes, let's get this in as is.
  21. core-ci voted on patch set 5 V +1 06/23/25, 08:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80578

  22. Stefan Bürk voted on patch set 5 CR +1 V +1 06/23/25, 08:47

  23. Garvin Hicking voted on patch set 5 CR +2 V +2 06/23/25, 08:48

  24. Torben Hansen voted on patch set 5 CR +1 V +1 06/23/25, 08:50

  25. Garvin Hicking merged patch set 6 06/23/25, 09:01