De-tainting a number
David Miller
justdave at syndicomm.com
Fri Jul 25 15:22:47 UTC 2003
On 7/25/2003 4:15 PM +0100, Mark Ingram wrote:
> There is just one small problem, a $bugid of 37 gets changed to 1 when i try
> it??
>
> I have the following code:
>
> my $bug_id = detaint_natural($bugid) ||
>ThrowUserError("invalid_bug_id");
> print "bug_id: $bug_id\n<br>bugid: $bugid";
>
> The print out looks like this:
> bug_id: 1
> bugid: 37
>
> Is there any particular reason for this?
Because that's not what I told you to do. ;)
Here's my original code sample:
> detaint_natural($bugid) || ThrowUserError("invalid_bug_id");
Notice I'm not assigning it to a variable. The return value is a 0/1 for
whether the value was successfully detainted or not. If it succeeded,
$bugid will be detainted. If it did not succeed, $bugid will now be
undefined (which is why you throw an error if it fails).
--
Dave Miller Project Leader, Bugzilla Bug Tracking System
http://www.justdave.net/ http://www.bugzilla.org/
More information about the developers
mailing list