Re: Re: is_int/is_numeric possible bug

From: Date: Tue, 29 Nov 2005 17:47:02 +0000
Subject: Re: Re: is_int/is_numeric possible bug
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-20851@lists.php.net to get a copy of this message
is_numeric will test if it's a numeric string. Maybe is_int should do the same, but apparently it doesn't. You could always do an is_numeric and if it returns true, cast it as an int. On Tue, 29 Nov 2005 12:42:10 -0500, Gareth Ardron <gareth@fission.org.uk> wrote:
Matteo Beccati wrote:
Gareth Ardron wrote:
Ron Korving wrote:
Just out of curiosity, to which versions does this apply?
5.1.0b3->5.1.1 at least. Haven't got anything older to test on.
As far as I know request variables have always been strings, and is_int() checks the variable type, not its content. I wonder how your code was previously working ;)
It wasn't, I was just helping a mate do something. New code. But still, it seems very odd to me - I mean, why does is_numeric() therefore work when is_int() doesn't - that seems like strange logic to me (though I admit I'm not the most logical of people). I just don't see the need to have to do: if (is_numeric($_REQUEST['var']) && is_int($_REQUEST['var'])) { when, at least in my mind, is_int() should do the job by itself.
-- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

« previous php.internals (#20851) next »