#106912The flexform migration is reporting old errors over and over again
Description
Hi everyone.
The flexform migration is reporting old errors for every field that is processes. Depending on the number of processed fields, it floods the deprecation log.
*What is happening in the code*
Here https://github.com/TYPO3/typo3/blob/v13.4.14/typo3/sysext/core/Classes/Configuration/FlexForm/FlexFormTools.php#L635
the field gets processed. We use the same instance repeatedly.
Here https://github.com/TYPO3/typo3/blob/v13.4.14/typo3/sysext/core/Classes/Configuration/FlexForm/FlexFormTools.php#L636
we retrieve the messages from the processing.
Here https://github.com/TYPO3/typo3/blob/v13.4.14/typo3/sysext/core/Classes/Configuration/Tca/TcaMigration.php#L103
you can find the getter for the messages.
Here https://github.com/TYPO3/typo3/blob/v13.4.14/typo3/sysext/core/Classes/Configuration/Tca/TcaMigration.php#L37
are the messages stored in the TcaMigration class.
- We are using the same instance of the TcaMigration class repeatedly.
- The messages in the top of the TcaMigration class are not reset with a new use of this class
- Set up a new TYPO3 13
- Install TT-Address. It has some older flexforms due to its compatibility to older TYPO3 versions
- Create a flexform using content element
- Get a
trigger_error(implode(LF, $messages), E_USER_DEPRECATED);with the same messages repeatedly.
*Proposed solution*
Reset the $this->messages with every call of the $this->tcaMigration->migrate($dummyTca);
here: https://github.com/TYPO3/typo3/blob/v13.4.14/typo3/sysext/core/Classes/Configuration/Tca/TcaMigration.php#L49
Could look like this:
/**
* Run some general TCA validations, then migrate old TCA to new TCA.
*
* This class is typically called within bootstrap with empty caches after all TCA
* files from extensions have been loaded. The migration is then applied and
* the migrated result is cached.
* For flex form TCA, this class is called dynamically if opening a record in the backend.
*
* See unit tests for details.
*/
public function migrate(array $tca): array
{
$this->messages = [];
$this->validateTcaType($tca);
$this->deprecateSubTypes($tca);
$tca = $this->migrateColumnsConfig($tca);
$tca = $this->migratePagesLanguageOverlayRemoval($tca);
. . .
Tobi