is_int/is_numeric possible bug

From: Date: Tue, 29 Nov 2005 15:57:00 +0000
Subject: is_int/is_numeric possible bug
Groups: php.internals 
Request: Send a blank email to internals+get-20837@lists.php.net to get a copy of this message
Hi. Think I've just stumbled upon a possible bug with is_int. if you've got the following code: <form action='1.php' method='post'> <input type='text' name='days'> <input type='submit' name='submit' value='submit'> </form> <?php if (!is_int($_REQUEST['days']) || $_REQUEST['days'] < 0) {
       $_REQUEST['days'] = 10;
} print "<br>days::".$_REQUEST['days']; ?> and somebody enters, say "jkhdsjh" into the form, is_int() returns 1, thereby not setting the $_REQUEST['days'] variable to 10 - if I switch to using is_numeric then everything works as it should. Obviously, this isn't ideal as somebody could then enter 2.5 rather than the integers that I want to be passed. Looking at the source, this is in ext/standard/type.c in the php_is_type() function which seems to be messing up. Can anybody confirm this is: a) undesired behaviour and I'm not just being very "special" and b) that this is happening. I've tried on two boxes with 5.1.1[0] but it'd help to get somebody else's opinion If it's a bug, I'll do a patch up later tonight - just want to get it confirmed first. Cheers. -- Gareth Ardron [0] both debian/linux boxes. One i386, one x86_64.

« previous php.internals (#20837) next »