[TYPO3-core] RFC #15020: Enhancement of t3lib_div::testInt

Dmitry Dulepov dmitry at typo3.org
Wed Jul 7 09:00:40 CEST 2010


Hi!

Michiel Roos [netcreators] wrote:
> Problem:
> t3lib_div::testInt can be optimized by making use of the PHP version of
> testInt called: is_int.

I think there is an issue here. Here is the description of is_int from the
PHP manual:

==============
Finds whether the type of the given variable is integer.
Note: To test if a variable is a number or a numeric string (such as form
input, which is always a string), you must use is_numeric().
==============

I just checked: is_int('5') gives false, while t3lib_div::testInt('5')
gives true. The idea of the later is to see if the argument can be
~interpreted~ as integer while the former checks if it ~is~ integer. The
difference is important.

-1 to the patch because it breaks the behavior. Sorry.

-- 
Dmitry Dulepov
TYPO3 core&security teams member
Twitter: http://twitter.com/dmitryd
Read more @ http://dmitry-dulepov.com/


More information about the TYPO3-team-core mailing list