From 0ddb000b0c5280b9a13d9b930ea21ecf546bd5c9 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Sat, 24 Oct 2009 05:26:35 +0000 Subject: Bug 523977: Make Bugzilla::Object->check send the trimmed value to new(), and also be more accurate about what's "empty". This also makes detaint_natural and detaint_signed call int() on their return values. Patch by Max Kanat-Alexander r=LpSolit, a=LpSolit --- Bugzilla/Util.pm | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'Bugzilla/Util.pm') diff --git a/Bugzilla/Util.pm b/Bugzilla/Util.pm index 513e02857..21588417c 100644 --- a/Bugzilla/Util.pm +++ b/Bugzilla/Util.pm @@ -68,17 +68,14 @@ sub trick_taint { sub detaint_natural { my $match = $_[0] =~ /^(\d+)$/; - $_[0] = $match ? $1 : undef; + $_[0] = $match ? int($1) : undef; return (defined($_[0])); } sub detaint_signed { my $match = $_[0] =~ /^([-+]?\d+)$/; - $_[0] = $match ? $1 : undef; - # Remove any leading plus sign. - if (defined($_[0]) && $_[0] =~ /^\+(\d+)$/) { - $_[0] = $1; - } + # The "int()" call removes any leading plus sign. + $_[0] = $match ? int($1) : undef; return (defined($_[0])); } -- cgit v1.2.3-24-g4f1b