summaryrefslogtreecommitdiffstats
path: root/globals.pl
diff options
context:
space:
mode:
authormyk%mozilla.org <>2001-08-20 03:26:21 +0200
committermyk%mozilla.org <>2001-08-20 03:26:21 +0200
commit5391f72b57b6bcecdc6349981eaf879917646c16 (patch)
tree4e8de3db08721c4e3e69edbc763018483e166668 /globals.pl
parent19fac474c4e5c37062fe55633943846430ef549f (diff)
downloadbugzilla-5391f72b57b6bcecdc6349981eaf879917646c16.tar.gz
bugzilla-5391f72b57b6bcecdc6349981eaf879917646c16.tar.xz
Fix for bug 95890: Correctly convert/record keyword changes in the bugs_activity table for keywords containing a plus sign or other
regular expression meta-characters. Myk's first ever Bugzilla checkin! Patch by Dave Miller <justdave@syndicomm.com> and Myk Melez <myk@mozilla.org>. r=myk@mozilla.org,justdave@syndicomm.com
Diffstat (limited to 'globals.pl')
-rw-r--r--globals.pl22
1 files changed, 10 insertions, 12 deletions
diff --git a/globals.pl b/globals.pl
index 3d14c9153..a3ea97c40 100644
--- a/globals.pl
+++ b/globals.pl
@@ -1295,24 +1295,22 @@ sub Param ($) {
sub DiffStrings {
my ($oldstr, $newstr) = @_;
+ # Split the old and new strings into arrays containing their values.
+ $oldstr =~ s/[\s,]+/ /g;
+ $newstr =~ s/[\s,]+/ /g;
+ my @old = split(" ", $oldstr);
+ my @new = split(" ", $newstr);
+
my (@remove, @add) = ();
- my @old = split(/[ ,]/, $oldstr);
- my @new = split(/[ ,]/, $newstr);
# Find values that were removed
- foreach my $value(@old) {
- next if $value =~ /^\s*$/;
- if (! grep /^$value$/, @new) {
- push (@remove, $value);
- }
+ foreach my $value (@old) {
+ push (@remove, $value) if !grep($_ eq $value, @new);
}
# Find values that were added
- foreach my $value(@new) {
- next if $value =~ /^\s*$/;
- if (! grep /^$value$/, @old) {
- push (@add, $value);
- }
+ foreach my $value (@new) {
+ push (@add, $value) if !grep($_ eq $value, @old);
}
my $removed = join (", ", @remove);