Bug #105619
openGeneralUtility::trimExplode(): Argument #2 ($string) must be of type string, null given, called in AbstractItemProvider.php on line 979
0%
Description
TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(): Argument #2 ($string) must be of type string, null given, called in /var/www/html/vendor/typo3/cms-backend/Classes/Form/FormDataProvider/AbstractItemProvider.php on line 979
I have a TCA select field with the following configuration. Items are automatically filled by a helper method and include an empty string as default value.
'course_country' => [
'exclude' => 1,
'label' => 'Course country',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'nullable' => true, // This does nothing for type select
'items' => LocalisationHelper::readCountriesForTCA(),
]
],
SQL definition:course_country varchar(3) NULL,
These records are created in the frontend and have this Model attribute:
public ?string $courseCountry = null;
So it's possible this database field is null. In TYPO3 v11 the backend form could be opened without a problem. Since v13 upgrade the error occurs. This is probably due to a missing check for null or missing type cast to string in AbstractItemProvider.
Additional note: There seems to be no possibility to have null values for select fields via the backend. Maybe it could be benefitial to introduce the nullable option for selects as well.