aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2015-01-05 19:34:02 +0100
committerFrédéric Buclin <LpSolit@gmail.com>2015-01-05 19:34:02 +0100
commit5fde8510f7f6e550ed4dcfcfd4608b09e4d1f7a8 (patch)
tree94c672dca09599218bff327ff39d833f12ad3ce9
parentBug 1097798: Do not display the resolution in the dependency tree for open bu... (diff)
downloadbugzilla-5fde8510f7f6e550ed4dcfcfd4608b09e4d1f7a8.tar.gz
bugzilla-5fde8510f7f6e550ed4dcfcfd4608b09e4d1f7a8.tar.bz2
bugzilla-5fde8510f7f6e550ed4dcfcfd4608b09e4d1f7a8.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.pm14
1 files changed, 7 insertions, 7 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index b57af4d39..b3931584c 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -363,16 +363,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.
- my $self = $class->new(trim($id));
- # For error messages, use the id that was returned by new(), because
- # it's cleaned up.
- $id = $self->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}) {
if ($self->{error} eq 'NotFound') {