Fix and try to avoid "list Package->.." bug
parent
04caa11915
commit
696a70c226
|
@ -83,7 +83,6 @@ sub _die_error
|
|||
{
|
||||
if ($msg =~ /lock wait|deadlock found/i)
|
||||
{
|
||||
use Data::Dumper;
|
||||
# Log active InnoDB locks
|
||||
my $locks = Bugzilla->dbh->selectall_arrayref('SELECT * FROM information_schema.innodb_locks', {Slice=>{}});
|
||||
$msg = "InnoDB locks:\n".Dumper($locks)."\n".$msg;
|
||||
|
|
|
@ -173,7 +173,7 @@ sub new_from_list
|
|||
foreach my $id (@$id_list)
|
||||
{
|
||||
detaint_natural($id) || ThrowCodeError('param_must_be_numeric', {function => $class . '::new_from_list'});
|
||||
# Too large integers make PostgreSQL crash.
|
||||
# Too large integers make PostgreSQL crash (FIXME: That's very STRANGE?!!)
|
||||
next if $id > MAX_INT_32;
|
||||
push(@detainted_ids, $id);
|
||||
}
|
||||
|
|
|
@ -949,8 +949,15 @@ sub bz_encode_json
|
|||
return $var;
|
||||
}
|
||||
|
||||
# Return empty list for undef or expand an arrayref
|
||||
sub list($)
|
||||
{
|
||||
# If you write "list Package->method->{something}", for example "list Bugzilla->input_params->{arg}",
|
||||
# Perl parses it as "(list Package)->method->{something}". But most Bugzilla modules use Bugzilla::Util
|
||||
# and thus have list() imported in their namespace, so (list Package) gets happily executed and you
|
||||
# just get "Package->method->{something}" without list().
|
||||
# Trry to fight it by checking if the calling context wants a list.
|
||||
wantarray or die "Possible bug: Bugzilla::Util::list() called without wantarray. Do not write 'list Package->method->...'";
|
||||
my ($array) = @_;
|
||||
return () unless defined $array;
|
||||
return ($array) if ref $array ne 'ARRAY';
|
||||
|
|
|
@ -269,7 +269,7 @@ exit;
|
|||
# Find any selected series and return either the first or all of them.
|
||||
sub getAndValidateSeriesIDs
|
||||
{
|
||||
my @series_ids = grep /^\d+$/, list Bugzilla->input_params->{name};
|
||||
my @series_ids = grep /^\d+$/, list(Bugzilla->input_params->{name});
|
||||
return wantarray ? @series_ids : $series_ids[0];
|
||||
}
|
||||
|
||||
|
|
|
@ -429,7 +429,7 @@ sub _do_add
|
|||
$current = $group->grant_direct($type);
|
||||
}
|
||||
|
||||
my $add_items = Bugzilla::Group->new_from_list([ list Bugzilla->input_params->{$field} ]);
|
||||
my $add_items = Bugzilla::Group->new_from_list([ list(Bugzilla->input_params->{$field}) ]);
|
||||
|
||||
foreach my $add (@$add_items)
|
||||
{
|
||||
|
@ -450,7 +450,7 @@ sub _do_add
|
|||
sub _do_remove
|
||||
{
|
||||
my ($group, $changes, $sth_delete, $field, $type, $reverse) = @_;
|
||||
my $remove_items = Bugzilla::Group->new_from_list([ list Bugzilla->input_params->{$field} ]);
|
||||
my $remove_items = Bugzilla::Group->new_from_list([ list(Bugzilla->input_params->{$field}) ]);
|
||||
|
||||
foreach my $remove (@$remove_items)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue