summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author <Koosha>2012-08-31 22:44:21 +0200
committerDave Lawrence <dlawrence@mozilla.com>2012-08-31 22:44:21 +0200
commit5f49df179c7ebd8c007ba4e0c22e76e98fca4334 (patch)
treee50593e82e3c346e1eda77e8a4e63a4270a8de09
parentad42be6a1b6e46697c4173c0bd50754a490c5b80 (diff)
downloadbugzilla-5f49df179c7ebd8c007ba4e0c22e76e98fca4334.tar.gz
bugzilla-5f49df179c7ebd8c007ba4e0c22e76e98fca4334.tar.xz
Bug 783222 - Make set_all() throw error on invalid param names
r/a=LpSolit
-rw-r--r--Bugzilla/Object.pm5
1 files changed, 5 insertions, 0 deletions
diff --git a/Bugzilla/Object.pm b/Bugzilla/Object.pm
index c20cef450..4db37f72f 100644
--- a/Bugzilla/Object.pm
+++ b/Bugzilla/Object.pm
@@ -335,12 +335,17 @@ sub set_all {
my %field_values = %$params;
my @sorted_names = $self->_sort_by_dep(keys %field_values);
+
foreach my $key (@sorted_names) {
# 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
# other set method.
next if !exists $field_values{$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);
}
Bugzilla::Hook::process('object_end_of_set_all',