From 0b7886dee88bfdc543855d13a8a3d3e25e675437 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Mon, 8 Dec 2014 18:00:17 +0000 Subject: Bug 1095244: DB crash when adding an alias that differs only in case from an existing alias r=glob,a=glob --- Bugzilla/Bug.pm | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'Bugzilla') 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 { -- cgit v1.2.1