summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2014-12-08 19:00:17 +0100
committerDavid Lawrence <dkl@mozilla.com>2014-12-08 19:00:17 +0100
commitd4ef4b1c44705696270e88f968bb72ef782156cb (patch)
treeabc00a72e8d4e20867c028c51185eb06c278152a
parent836f2b06076c2679da6a9ac6ae00e1abb69aa200 (diff)
downloadbugzilla-d4ef4b1c44705696270e88f968bb72ef782156cb.tar.gz
bugzilla-d4ef4b1c44705696270e88f968bb72ef782156cb.tar.xz
Bug 1095244: DB crash when adding an alias that differs only in case from an existing alias
r=glob,a=glob
-rw-r--r--Bugzilla/Bug.pm15
1 files changed, 13 insertions, 2 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index aec7c1e82..73ba62a3b 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -2910,8 +2910,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 {