[TYPO3-dev] behaviour of t3lib_div::testInt has been changed

Steffen Ritter info at rs-websystems.de
Thu Sep 9 15:29:43 CEST 2010


Am 09.09.2010 15:24, schrieb JoH asenau:
>>>>>> I have observed that the behaviour of the function
>>>>>> t3lib_div::testInt has been changed.
>>>>>
>>>>> there was a very long discussion about this topic in the core list.
>>>>> Have a look at RFC #15020.
>>>>
>>>> as far as I see this should have been a performance improvement
>>>> only. Obviously no test has been made for a string like '10.' as it
>>>> comes from TypoScript.
>>>
>>> And what would be the expected result in this case?
>>
>> 10. is a floating point number - in java, in c, in php in javascript
>> :) i would expect to get a false on testInt(), Franz is right there.
>
> 10.xx would be a floating point number, but it could be "interpreted as integer" as well (as long as there is no value>  0 after the dot), which is what the description of the function tells.
> As far as I understood, this is why the function has been kept instead of replacing it with is_int() or something similar.
> So 10.01 could not be "interpreted as integer", while 10.00 and 10. could.
>
> So I guess that
> a) the behaviour of the function was wrong before, if it returned a different value
> b) the change actually is a bugfix and
> c) the usage of testInt() to eliminate TS array keys containing a dot is no good idea at all, since there might be array keys like "blah." as well
> d) strpos or substr would be preferrable here
>
> Just my 2 cents
>
> Joey
>
Okay, you're right the function tells it tests intepretation as int, not 
if it is an int :)






More information about the TYPO3-dev mailing list