]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 783222 - Make set_all() throw error on invalid param names
author <Koosha> <>
Fri, 31 Aug 2012 20:41:55 +0000 (16:41 -0400)
committerDave Lawrence <dlawrence@mozilla.com>
Fri, 31 Aug 2012 20:41:55 +0000 (16:41 -0400)
r/a=LpSolit

Bugzilla/Object.pm

index c606540fa7b8c2b14278d71785e7065e36dd45b4..531b81711138682e897c8bde31d7293245ec0d3f 100644 (file)
@@ -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',