Bug #22457
closedIRRE takes 100000 as default for TCA maxitems but it should be 1
0%
Description
The default value of maxitems in TCA is documented in doc_core_api for the types "select", "group", and "inline": "Maximum number of items in the selector box. (Default = 1)"
But for type "inline" it is actually 100000. This causes massive problems if switching from type "select" (where it is actually 1) to type "inline". In Extbase "maxitems" is taken into account to determine the cardinality (1:1,1:n, m:n) of a relation.
The attached patch changes the default of "maxitems" for type "inline" to 1. But this will break a lot of existing extensions using IRRE! Because most of the developers set up their TCA without adding "maxitems" => 99999 to allow multiple records. They might not even know the maxitems should default to 1.
The patch is straight forward but the root cause is concealed. In t3lib_tceforms as well as in t3lib_tceforms_inline you find the following two lines:
$maxitems = t3lib_div::intInRange($config['maxitems'],0);
if (!$maxitems) $maxitems=100000;
But in t3lib_tceforms $config['maxitems'] can not be 0 or 1 because of
$maxitems = intval($config['maxitems']);
if ($maxitems<=1) {
$item = $this->getSingleField_typeSelect_single([...]);
} elseif (!strcmp($config['renderMode'],'checkbox')) {
[...]
}
some lines before. If $config['maxitems'] is not set in t3lib_tceforms_inline the function t3lib_div::intInRange($config['maxitems'],0); will return 0. And !$maxitems will be casted to FALSE (sometimes I really hate dynamically typed languages).
(issue imported from #M14113)
Files