#108989Schema Api ->getField some times results in Type Error
Description
Uncaught TYPO3 Exception TYPO3\CMS\Core\Schema\Struct\SelectItem::__construct(): Argument #2 ($label) must be of type string, int given, called in typo3/sysext/core/Classes/Schema/Struct/SelectItem.php on line 48 thrown in file typo3/sysext/core/Classes/Schema/Struct/SelectItem.php in line 31
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Schema\TcaSchemaFactory::class)
->get('sys_file_metadata.1')
->getField('ranking')
->getItems();
This is because in sys_file_metadata.ranking the items have labels that are integers:
https://github.com/TYPO3/typo3/blob/53c3514c99728b8582b915dac22f3007627db541/typo3/sysext/filemetadata/Configuration/TCA/Overrides/sys_file_metadata.php#L349-L354
We could only switch the int to string.
But that would not fix the situation in the extensions that still use int.
So we cast to string.
Broken in v13 and v14
Reviews 2
History 24
-
Gerrit Code Review pushed patch set 1 for main to change 92856 status
NewUnder Review 02/16/26, 14:41 -
Gerrit Code Review pushed patch set 1 for 13.4 to change 92860 02/16/26, 18:04
-
Matthias Vogel commented and changed status
Under ReviewResolved done0 %100 % 02/16/26, 19:05 -
Benni Mack changed status
ResolvedClosed 03/31/26, 08:11
Applied in changeset commit:467d10191441a07361fb91813f216fed8384f2e0.