Issue Bug Closed

#57393Endless Loop in TceformsUpdateWizard

Benjamin Pucher 03/27/14, 15:49 updated 10/02/18, 11:58

Description

I’m currently updating a large TYPO3 Website from 4.5 to 6.2 and have found a bug in the Upgrade Wizard.
The migration with title ‘Migrate all file relations from tt_content.image and pages.media’ (typo3/sysext/install/Classes/Updates/TceformsUpdateWizard.php) ends up in an endless loop.
The problem exists in the do/while loop starting at line 188 respectively in the getRecordsFromTable method in typo3/sysext/install/Classes/Updates/TceformsUpdateWizard.php.

188 do {
189     $records = $this->getRecordsFromTable($table, $fieldToMigrate, $fieldsToGet, self::RECORDS_PER_QUERY);
190     foreach ($records as $record) {
191         $this->migrateField($table, $record, $fieldToMigrate, $fieldConfiguration, $customMessages);
192     }
193 } while (count($records) === self::RECORDS_PER_QUERY);

self::RECORDS_PER_QUERY is set to 1000. Every time a query like ‘select … LIMIT 1000’ is created. Because there’s no starting point defined after the LIMIT statement (which should be 0 on first loop and then += self::RECORDS_PER_QUERY) the query will always fetch the first self::RECORDS_PER_QUERY entries. Thus the while condition is always true.
To fix this the LIMIT statement should have the starting point included like LIMIT <entries_fetched_so_far>, self::RECORDS_PER_QUERY.</entries_fetched_so_far>

Please fix this asap since many people will update their TYPO3 LTS Websites shortly.

Reviews 1