diff options
author | Byron Jones <bjones@mozilla.com> | 2013-01-07 06:46:38 +0100 |
---|---|---|
committer | Byron Jones <bjones@mozilla.com> | 2013-01-07 06:46:38 +0100 |
commit | 292ad609ffad27232699a5c5db2b244a28881267 (patch) | |
tree | 7f54c6c1fe50c7ca544e28d19f83194761556f63 | |
parent | 9ee81348aaa57b34f0c4f0b75bc387f24beb451e (diff) | |
download | bugzilla-292ad609ffad27232699a5c5db2b244a28881267.tar.gz bugzilla-292ad609ffad27232699a5c5db2b244a28881267.tar.xz |
Bug 825718: Fix Bugzilla::Bug->check() wrt caching mechanism
r=LpSolit,r=LpSolit
-rw-r--r-- | Bugzilla/Bug.pm | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 7c7e0fb37..4485b620c 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -372,14 +372,16 @@ sub cache_key { sub check { my $class = shift; - my ($id, $field) = @_; - - ThrowUserError('improper_bug_id_field_value', { field => $field }) unless defined $id; + my ($param, $field) = @_; # Bugzilla::Bug throws lots of special errors, so we don't call # SUPER::check, we just call our new and do our own checks. - $id = trim($id); - my $self = $class->new($id); + my $id = ref($param) + ? ($param->{id} = trim($param->{id})) + : ($param = trim($param)); + ThrowUserError('improper_bug_id_field_value', { field => $field }) unless defined $id; + + my $self = $class->new($param); if ($self->{error}) { # For error messages, use the id that was returned by new(), because |