diff options
author | 2015-01-05 19:30:57 +0100 | |
---|---|---|
committer | 2015-01-05 19:30:57 +0100 | |
commit | 9e8c5571d3e38a69ccaa8f9b3a68dcd0f866c2d8 (patch) | |
tree | d421ae75ad62471d00468afd8060fcc130abc152 | |
parent | Bug 1106653: Truncate the field-* and type-* values in error messages (diff) | |
download | bugzilla-9e8c5571d3e38a69ccaa8f9b3a68dcd0f866c2d8.tar.gz bugzilla-9e8c5571d3e38a69ccaa8f9b3a68dcd0f866c2d8.tar.bz2 bugzilla-9e8c5571d3e38a69ccaa8f9b3a68dcd0f866c2d8.zip |
Bug 1085182: Bugzilla::Bug->check must check that a bug ID is defined when it gets a hashref
r=dkl a=glob
-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 d0e8f462b..b390c12d4 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -354,14 +354,16 @@ sub new { 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 |