Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:20838 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62909 invoked by uid 1010); 29 Nov 2005 16:27:41 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 62891 invoked from network); 29 Nov 2005 16:27:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Nov 2005 16:27:41 -0000 X-Host-Fingerprint: 195.225.34.5 fw01.axit.nl Received: from ([195.225.34.5:6652] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 8E/A3-14828-D718C834 for ; Tue, 29 Nov 2005 11:27:41 -0500 Message-ID: <8E.A3.14828.D718C834@pb1.pair.com> To: internals@lists.php.net References: <438C7A4C.9090503@fission.org.uk> Date: Tue, 29 Nov 2005 17:13:59 +0100 Lines: 49 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2670 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670 X-Posted-By: 195.225.34.5 Subject: Re: is_int/is_numeric possible bug From: r.korving@xit.nl ("Ron Korving") Just out of curiosity, to which versions does this apply? Ron "Gareth Ardron" schreef in bericht news:438C7A4C.9090503@fission.org.uk... > Hi. > > Think I've just stumbled upon a possible bug with is_int. > > if you've got the following code: > >
> > >
> if (!is_int($_REQUEST['days']) || $_REQUEST['days'] < 0) { > $_REQUEST['days'] = 10; > } > print "
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.