diff options
author | mkanat%bugzilla.org <> | 2009-10-24 05:26:35 +0000 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2009-10-24 05:26:35 +0000 |
commit | 0ddb000b0c5280b9a13d9b930ea21ecf546bd5c9 (patch) | |
tree | c930d99f072e893e6dd6e91e6b1ae555c09632e9 /Bugzilla/Util.pm | |
parent | ad9d2eb59d635d1d7a4fb8b2bf110c9aca495ae1 (diff) | |
download | bugs-0ddb000b0c5280b9a13d9b930ea21ecf546bd5c9.tar bugs-0ddb000b0c5280b9a13d9b930ea21ecf546bd5c9.tar.gz bugs-0ddb000b0c5280b9a13d9b930ea21ecf546bd5c9.tar.bz2 bugs-0ddb000b0c5280b9a13d9b930ea21ecf546bd5c9.tar.xz bugs-0ddb000b0c5280b9a13d9b930ea21ecf546bd5c9.zip |
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 <mkanat@bugzilla.org> r=LpSolit, a=LpSolit
Diffstat (limited to 'Bugzilla/Util.pm')
-rw-r--r-- | Bugzilla/Util.pm | 9 |
1 files changed, 3 insertions, 6 deletions
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])); } |