diff options
author | David Lawrence <dkl@mozilla.com> | 2014-12-08 18:00:17 +0000 |
---|---|---|
committer | David Lawrence <dkl@mozilla.com> | 2014-12-08 18:01:34 +0000 |
commit | 0b7886dee88bfdc543855d13a8a3d3e25e675437 (patch) | |
tree | 4e1cea6d4bdda494042045c5c09f4a390cc74c03 /Bugzilla | |
parent | d0a09b15993de173c5b40bc582f3ef6dc712c55d (diff) | |
download | bugs-0b7886dee88bfdc543855d13a8a3d3e25e675437.tar bugs-0b7886dee88bfdc543855d13a8a3d3e25e675437.tar.gz bugs-0b7886dee88bfdc543855d13a8a3d3e25e675437.tar.bz2 bugs-0b7886dee88bfdc543855d13a8a3d3e25e675437.tar.xz bugs-0b7886dee88bfdc543855d13a8a3d3e25e675437.zip |
Bug 1095244: DB crash when adding an alias that differs only in case from an existing alias
r=glob,a=glob
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/Bug.pm | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 7b97d1ff8..a49656e07 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -2905,8 +2905,19 @@ sub add_alias { return if !$alias; my $aliases = $self->_check_alias($alias); $alias = $aliases->[0]; - my $bug_aliases = $self->alias; - push(@$bug_aliases, $alias) if !grep($_ eq $alias, @$bug_aliases); + my @new_aliases; + my $found = 0; + foreach my $old_alias (@{ $self->alias }) { + if (lc($old_alias) eq lc($alias)) { + push(@new_aliases, $alias); + $found = 1; + } + else { + push(@new_aliases, $old_alias); + } + } + push(@new_aliases, $alias) if !$found; + $self->{alias} = \@new_aliases; } sub remove_alias { |