[TYPO3-core] RFC: Bug #14113: IRRE takes 100000 as default for TCA maxitems but it should be 1

Jigal van Hemert jigal at xs4all.nl
Thu Apr 15 09:27:09 CEST 2010


Jochen Rau wrote:
> 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).

Wow! Obfuscated PHP programming ;-)

You can partly blame the language for allowing such things, but on the 
other hand nobody forces a developer to use such ugly constructions.

I would like to see rules in CGL against implicit conversions (unless 
they are vital for speed in a particular case).
strcmp() is also such an ugly child... it doesn't return intuitive 
values: if both arguments are 'equal' it returns 0, which evaluates to 
boolean FALSE in a condition

} elseif (!strcmp($config['renderMode'],'checkbox')) {

is much harder to read then

} elseif ($config['renderMode'] === 'checkbox') {

To get back to your RFC :-)

+1 by reading, also for wanting consistent behaviour throughout the core.

While you're editing this part,
	if (!$maxitems) $maxitems=100000;
should be changed according to CGL.

-- 
Jigal van Hemert
skype:jigal.van.hemert
msn: jigal at xs4all.nl
http://twitter.com/jigalvh


More information about the TYPO3-team-core mailing list