[TYPO3-core] RFC: Bug #14113: IRRE takes 100000 as default for TCA maxitems but it should be 1
Jochen Rau
jochen.rau at typoplanet.de
Wed Apr 14 22:54:49 CEST 2010
This is an SVN patch request.
Type: Bugfix
Bugtracker references:
http://bugs.typo3.org/view.php?id=14113
Branches:
trunk
Problem:
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.
Solution:
The attached patch changes the default of "maxitems" for type "inline"
to 1. This is a breaking change [!!!].
Notes:
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).
Regards
Jochen
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: bug_14113_v1.diff
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20100414/340e9d43/attachment.txt>
More information about the TYPO3-team-core
mailing list