Commit 30987a36 authored by 's avatar Committed by Dave Lawrence

Bug 783222 - Make set_all() throw error on invalid param names

r/a=LpSolit
parent 72661fd5
...@@ -321,12 +321,17 @@ sub set_all { ...@@ -321,12 +321,17 @@ sub set_all {
my %field_values = %$params; my %field_values = %$params;
my @sorted_names = $self->_sort_by_dep(keys %field_values); my @sorted_names = $self->_sort_by_dep(keys %field_values);
foreach my $key (@sorted_names) { foreach my $key (@sorted_names) {
# It's possible for one set_ method to delete a key from $params # It's possible for one set_ method to delete a key from $params
# for another set method, so if that's happened, we don't call the # for another set method, so if that's happened, we don't call the
# other set method. # other set method.
next if !exists $field_values{$key}; next if !exists $field_values{$key};
my $method = "set_$key"; my $method = "set_$key";
if (!$self->can($method)) {
my $class = ref($self) || $self;
ThrowCodeError("unknown_method", { method => "${class}::${method}" });
}
$self->$method($field_values{$key}, \%field_values); $self->$method($field_values{$key}, \%field_values);
} }
Bugzilla::Hook::process('object_end_of_set_all', Bugzilla::Hook::process('object_end_of_set_all',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment