Issue Bug Closed

#109603SchemaMigrator regression in merging columns and indexes

Riny van Tiggelen 04/16/26, 12:32 updated 04/21/26, 11:30

Description

In 2024 a bugfix was made to prevent the PHP error “Named parameter $columName overwrites previous argument” ($columName is an example):
https://review.typo3.org/c/Packages/TYPO3.CMS/+/85476

With some of the PHPstan fixes lately this has been reverted:
https://review.typo3.org/c/Packages/TYPO3.CMS/+/92798/10/typo3/sysext/core/Classes/Database/Schema/SchemaMigrator.php

Which caused the problem to return, this problem occurs when having columns/indexes definitions for the same table in multiple places.
For some reason this error does not show up in the Database Analyzer, but it shows up while opening the Upgrade Wizard:

I get the error with the Yoast SEO extension:

(1/1) Error
Named parameter $tx_yoastseo_cornerstone overwrites previous argument
in /var/www/html/v14/vendor/typo3/cms-core/Classes/Database/Schema/SchemaMigrator.php line 337
$currentTableDefinition = $return[$tableName];
$return[$tableName] = new Table(
$tableName,
$this->mergeColumns(…$currentTableDefinition->getColumns(), …$table->getColumns()),
$this->mergeIndexes(…$currentTableDefinition->getIndexes(), …$table->getIndexes()), <—
[],
array_merge($currentTableDefinition->getForeignKeys(), $table->getForeignKeys()),
array_merge($currentTableDefinition->getOptions(), $table->getOptions())
);
in /var/www/html/v14/vendor/typo3/cms-core/Classes/Database/Schema/SchemaMigrator.php line 226
protected function parseCreateTableStatements(array $statements): array {
$tables = $this->prepareTablesFromStatements($statements);
$tables = $this->ensureTableDefinitionForAllTCAManagedTables($tables);
$tables = $this->mergeTableDefinitions($tables); <—
$tables = $this->enrichTablesFromDefaultTCASchema($tables);
$tables = $this->ensureDefaultTCAFieldsAreOrdered($tables);
return $tables;
}

Reviews 1