Re: is_int/is_numeric possible bug

From: Date: Tue, 29 Nov 2005 17:20:37 +0000
Subject: Re: is_int/is_numeric possible bug
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-20844@lists.php.net to get a copy of this message
Florian Anderiasch wrote:
Gareth Ardron wrote:
Hi. Think I've just stumbled upon a possible bug with is_int.
Hello Gareth, if I'm not mistaken, $_REQUEST['days'] is a string, and unless you use if (!is_int(intval($_REQUEST['days'])) || $_REQUEST['days'] < 0) { I see no problem in is_int taking a string with numerals inside as not int.
the problem with this (which I did try before posting) is that of course is somebody enters a text string, and you run intval() on that, it'll return 1, not 0 as it has content. Only if it's empty would it return zero, and as such is_int() will return 1/true again.

« previous php.internals (#20844) next »