From: lpsolit%gmail.com <> Date: Wed, 21 Dec 2005 05:49:26 +0000 (+0000) Subject: Bug 320866: Watching the same address twice produces software error - Patch by Frédér... X-Git-Tag: bugzilla-2.20.1~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1aaa973cdd939ddb7cbc9d38257f191337143808;p=thirdparty%2Fbugzilla.git Bug 320866: Watching the same address twice produces software error - Patch by Frédéric Buclin r=kevin r=bkor a=justdave --- diff --git a/userprefs.cgi b/userprefs.cgi index 8d59a34e31..02646568d8 100755 --- a/userprefs.cgi +++ b/userprefs.cgi @@ -281,12 +281,12 @@ sub SaveEmail { # The new information given to us by the user. my @new_watch_names = split(/[,\s]+/, $cgi->param('watchedusers')); - my @new_watch_ids = (); + my %new_watch_ids; foreach my $username (@new_watch_names) { my $watched_userid = DBNameToIdAndCheck(trim($username)); - push(@new_watch_ids, $watched_userid); + $new_watch_ids{$watched_userid} = 1; } - my ($removed, $added) = diff_arrays($old_watch_ids, \@new_watch_ids); + my ($removed, $added) = diff_arrays($old_watch_ids, [keys %new_watch_ids]); # Remove people who were removed. my $delete_sth = $dbh->prepare('DELETE FROM watch WHERE watched = ?'