From: Date: Fri, 31 Aug 2012 20:42:56 +0000 (-0400) Subject: Bug 783222 - Make set_all() throw error on invalid param names X-Git-Tag: bugzilla-4.4rc1~82 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5286eda4b7aaa590a7f479bbcc8beba18067f843;p=thirdparty%2Fbugzilla.git Bug 783222 - Make set_all() throw error on invalid param names r/a=LpSolit --- diff --git a/Bugzilla/Object.pm b/Bugzilla/Object.pm index c606540fa7..531b817111 100644 --- a/Bugzilla/Object.pm +++ b/Bugzilla/Object.pm @@ -321,12 +321,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',