diff --git a/Bugzilla/App/Plugin/Glue.pm b/Bugzilla/App/Plugin/Glue.pm index 7ac88cbc84..22f5576329 100644 --- a/Bugzilla/App/Plugin/Glue.pm +++ b/Bugzilla/App/Plugin/Glue.pm @@ -190,7 +190,7 @@ sub register { # In this circumstance we run quotemeta first because we need to # insert an active regex meta-character afterward. $regex = quotemeta($attach_base); - $regex =~ s/\\\%bugid\\\%/\\d+/; + $regex =~ s/\\\%bugid\\\%/(?a:\\d+)/; } $regex = "^$regex"; return ($c->req->url->to_abs =~ $regex) ? 1 : 0; diff --git a/Bugzilla/App/Plugin/Hostage.pm b/Bugzilla/App/Plugin/Hostage.pm index 4b05d816f9..124dcc049b 100644 --- a/Bugzilla/App/Plugin/Hostage.pm +++ b/Bugzilla/App/Plugin/Hostage.pm @@ -18,7 +18,7 @@ sub _attachment_host_regex { $val =~ s{^https?://}{}s; $val =~ s{/$}{}s; my $regex = quotemeta $val; - $regex =~ s/\\\%bugid\\\%/\\d+/g; + $regex =~ s/\\\%bugid\\\%/(?a:\\d+)/g; return qr/^$regex$/s; } @@ -33,7 +33,7 @@ sub _before_routes { state $urlbase = Bugzilla->localconfig->urlbase; state $urlbase_uri = URI->new($urlbase); state $urlbase_host = $urlbase_uri->host; - state $urlbase_host_regex = qr/^bug(\d+)\.\Q$urlbase_host\E$/; + state $urlbase_host_regex = qr/^bug(\d+)\.\Q$urlbase_host\E$/a; state $attachment_base = Bugzilla->localconfig->attachment_base; state $attachment_root = _attachment_root($attachment_base); state $attachment_host_regex = _attachment_host_regex($attachment_base); diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 2134075e92..3222d79616 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -342,7 +342,7 @@ sub new { my $param = shift; # Remove leading "#" mark if we've just been passed an id. - if (!ref $param && $param =~ /^#(\d+)$/) { + if (!ref $param && $param =~ /^#(\d+)$/a) { $param = $1; } @@ -1546,7 +1546,7 @@ sub _check_alias { } # Make sure the alias isn't just a number. - if ($alias =~ /^\d+$/) { + if ($alias =~ /^\d+$/a) { ThrowUserError("alias_is_numeric", {alias => $alias}); } diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm index d49fd8c4f1..6a4721ffa4 100644 --- a/Bugzilla/BugMail.pm +++ b/Bugzilla/BugMail.pm @@ -599,8 +599,8 @@ sub _get_diffs { $diff->{isprivate} = $diff->{new}; } elsif ($diff->{field_name} =~ /^(?:dependson|blocked|regress(?:ed_by|es))$/) { - push @$referenced_bugs, grep {/^\d+$/} split(/[\s,]+/, $diff->{old}); - push @$referenced_bugs, grep {/^\d+$/} split(/[\s,]+/, $diff->{new}); + push @$referenced_bugs, grep {/^\d+$/a} split(/[\s,]+/, $diff->{old}); + push @$referenced_bugs, grep {/^\d+$/a} split(/[\s,]+/, $diff->{new}); } elsif ($diff->{field_name} eq 'see_also') { foreach my $field ('new', 'old') { @@ -676,9 +676,9 @@ sub _get_new_bugmail_fields { sub _parse_see_also { my (@links) = @_; my $urlbase = Bugzilla->localconfig->urlbase; - my $bug_link_re = qr/^\Q$urlbase\Eshow_bug\.cgi\?id=(\d+)$/; + my $bug_link_re = qr/^\Q$urlbase\Eshow_bug\.cgi\?id=(\d+)$/a; - return grep { /^\d+$/ } map { /$bug_link_re/ ? int($1) : () } @links; + return grep { /^\d+$/a } map { /$bug_link_re/ ? int($1) : () } @links; } 1; diff --git a/Bugzilla/BugUrl/Aha.pm b/Bugzilla/BugUrl/Aha.pm index 87f9ee74cc..81f8e57c0e 100644 --- a/Bugzilla/BugUrl/Aha.pm +++ b/Bugzilla/BugUrl/Aha.pm @@ -20,13 +20,13 @@ use base qw(Bugzilla::BugUrl); sub should_handle { my ($class, $uri) = @_; - return $uri =~ m!^https?://[^.]+\.aha\.io/features/(\w+-\d+)!; + return $uri =~ m!^https?://[^.]+\.aha\.io/features/(\w+-\d+)!a; } sub get_feature_id { my ($self) = @_; - if ($self->{value} =~ m!^https?://[^.]+\.aha\.io/features/(\w+-\d+)!) { + if ($self->{value} =~ m!^https?://[^.]+\.aha\.io/features/(\w+-\d+)!a) { return $1; } } diff --git a/Bugzilla/BugUrl/Debian.pm b/Bugzilla/BugUrl/Debian.pm index affc1bd28f..b5175c9238 100644 --- a/Bugzilla/BugUrl/Debian.pm +++ b/Bugzilla/BugUrl/Debian.pm @@ -33,7 +33,7 @@ sub _check_value { # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1234 # http://bugs.debian.org/1234 my $bug_id; - if ($uri->path =~ m|^/(\d+)$|) { + if ($uri->path =~ m|^/(\d+)$|a) { $bug_id = $1; } elsif ($uri->path =~ /bugreport\.cgi$/) { diff --git a/Bugzilla/BugUrl/Edge.pm b/Bugzilla/BugUrl/Edge.pm index e9aa5a8703..c5b144eec8 100644 --- a/Bugzilla/BugUrl/Edge.pm +++ b/Bugzilla/BugUrl/Edge.pm @@ -36,9 +36,9 @@ sub _check_value { $uri = $class->SUPER::_check_value($uri); - return $uri if $uri->path =~ m{^/en-us/microsoft-edge/platform/issues/\d+/$}; + return $uri if $uri->path =~ m{^/en-us/microsoft-edge/platform/issues/\d+/$}a; return $uri - if $uri->path =~ m{^/forums/\d+(?:-[^/]+)?/suggestions/\d+(?:-[^/]+)?}; + if $uri->path =~ m{^/forums/\d+(?:-[^/]+)?/suggestions/\d+(?:-[^/]+)?}a; ThrowUserError('bug_url_invalid', {url => "$uri"}); } diff --git a/Bugzilla/BugUrl/GitHub.pm b/Bugzilla/BugUrl/GitHub.pm index 795a8e317f..884fbe07b8 100644 --- a/Bugzilla/BugUrl/GitHub.pm +++ b/Bugzilla/BugUrl/GitHub.pm @@ -25,7 +25,7 @@ sub should_handle { # GitHub pull request URLs have only one form: # https://github.com/USER_OR_TEAM_OR_ORGANIZATION_NAME/REPOSITORY_NAME/pull/111 return (lc($uri->authority) eq 'github.com' - and $uri->path =~ m!^/[^/]+/[^/]+/(?:issues|pull)/\d+$!) ? 1 : 0; + and $uri->path =~ m!^/[^/]+/[^/]+/(?:issues|pull)/\d+$!a) ? 1 : 0; } sub _check_value { diff --git a/Bugzilla/BugUrl/GitLab.pm b/Bugzilla/BugUrl/GitLab.pm index 0bf7201f6b..8d43d56bb5 100644 --- a/Bugzilla/BugUrl/GitLab.pm +++ b/Bugzilla/BugUrl/GitLab.pm @@ -22,7 +22,7 @@ sub should_handle { # GitLab issue and merge request URLs can have the form: # https://gitlab.com/projectA/subprojectB/subprojectC/../(issues|merge_requests)/53 - return ($uri->path =~ m!^/.*/(issues|merge_requests)/\d+$!) ? 1 : 0; + return ($uri->path =~ m!^/.*/(issues|merge_requests)/\d+$!a) ? 1 : 0; } sub _check_value { diff --git a/Bugzilla/BugUrl/JIRA.pm b/Bugzilla/BugUrl/JIRA.pm index f92251958e..b85d5a1588 100644 --- a/Bugzilla/BugUrl/JIRA.pm +++ b/Bugzilla/BugUrl/JIRA.pm @@ -21,7 +21,7 @@ use Bugzilla::Util; sub should_handle { my ($class, $uri) = @_; - return ($uri->path =~ m|/browse/[A-Z][A-Z]+-\d+$|) ? 1 : 0; + return ($uri->path =~ m|/browse/[A-Z][A-Z]+-\d+$|a) ? 1 : 0; } sub _check_value { diff --git a/Bugzilla/BugUrl/Launchpad.pm b/Bugzilla/BugUrl/Launchpad.pm index 0049860352..0d18f2ecb3 100644 --- a/Bugzilla/BugUrl/Launchpad.pm +++ b/Bugzilla/BugUrl/Launchpad.pm @@ -34,7 +34,7 @@ sub _check_value { # https://bugs.launchpad.net/ubuntu/+bug/1234 # https://launchpad.net/bugs/1234 # All variations end with either "/bugs/1234" or "/+bug/1234" - if ($uri->path =~ m|bugs?/(\d+)$|) { + if ($uri->path =~ m|bugs?/(\d+)$|a) { # This is the shortest standard URL form for Launchpad bugs, # and so we reduce all URLs to this. diff --git a/Bugzilla/BugUrl/MantisBT.pm b/Bugzilla/BugUrl/MantisBT.pm index c48d7f797f..bff35057f8 100644 --- a/Bugzilla/BugUrl/MantisBT.pm +++ b/Bugzilla/BugUrl/MantisBT.pm @@ -21,7 +21,7 @@ use Bugzilla::Util; sub should_handle { my ($class, $uri) = @_; - return ($uri->path_query =~ m|view\.php\?id=\d+$|) ? 1 : 0; + return ($uri->path_query =~ m|view\.php\?id=\d+$|a) ? 1 : 0; } sub _check_value { diff --git a/Bugzilla/BugUrl/MozSentry.pm b/Bugzilla/BugUrl/MozSentry.pm index 576b633661..93ae2ca32b 100644 --- a/Bugzilla/BugUrl/MozSentry.pm +++ b/Bugzilla/BugUrl/MozSentry.pm @@ -15,7 +15,7 @@ use base qw(Bugzilla::BugUrl); sub should_handle { my ($class, $uri) = @_; - return $uri =~ m{^https?://sentry[.]prod[.]mozaws[.]net/operations/[^/]+/issues/\d+/?$}sxm; + return $uri =~ m{^https?://sentry[.]prod[.]mozaws[.]net/operations/[^/]+/issues/\d+/?$}asxm; } sub _check_value { diff --git a/Bugzilla/BugUrl/MozSupport.pm b/Bugzilla/BugUrl/MozSupport.pm index e4764cf010..435e2f0762 100644 --- a/Bugzilla/BugUrl/MozSupport.pm +++ b/Bugzilla/BugUrl/MozSupport.pm @@ -23,7 +23,7 @@ sub should_handle { # Mozilla support questions normally have the form: # https://support.mozilla.org//questions/ return ($uri->authority =~ /^support.mozilla.org$/i - and $uri->path =~ m|^(/[^/]+)?/questions/\d+$|) ? 1 : 0; + and $uri->path =~ m|^(/[^/]+)?/questions/\d+$|a) ? 1 : 0; } sub _check_value { diff --git a/Bugzilla/BugUrl/Phabricator.pm b/Bugzilla/BugUrl/Phabricator.pm index c71942f528..66c61e14a3 100644 --- a/Bugzilla/BugUrl/Phabricator.pm +++ b/Bugzilla/BugUrl/Phabricator.pm @@ -21,7 +21,7 @@ sub should_handle { # https://admin.phacility.com/PHI\d+ # https://secure.phabricator.com/T\d+ # https://secure.phabricator.com/D\d+ - return ($uri->path =~ m#/(PHI|D|T)\d+$#) ? 1 : 0; + return ($uri->path =~ m#/(PHI|D|T)\d+$#a) ? 1 : 0; } sub _check_value { diff --git a/Bugzilla/BugUrl/Splat.pm b/Bugzilla/BugUrl/Splat.pm index 701874fb39..32628a7762 100644 --- a/Bugzilla/BugUrl/Splat.pm +++ b/Bugzilla/BugUrl/Splat.pm @@ -15,7 +15,7 @@ use base qw(Bugzilla::BugUrl); sub should_handle { my ($class, $uri) = @_; - return $uri =~ m#^https?://hellosplat\.com/s/beanbag/tickets/\d+#; + return $uri =~ m#^https?://hellosplat\.com/s/beanbag/tickets/\d+#a; } sub _check_value { diff --git a/Bugzilla/BugUrl/Trac.pm b/Bugzilla/BugUrl/Trac.pm index 05d36e2009..b0a82b12e0 100644 --- a/Bugzilla/BugUrl/Trac.pm +++ b/Bugzilla/BugUrl/Trac.pm @@ -21,7 +21,7 @@ use Bugzilla::Util; sub should_handle { my ($class, $uri) = @_; - return ($uri->path =~ m|/ticket/\d+$|) ? 1 : 0; + return ($uri->path =~ m|/ticket/\d+$|a) ? 1 : 0; } sub _check_value { diff --git a/Bugzilla/BugUrl/WebCompat.pm b/Bugzilla/BugUrl/WebCompat.pm index f72b2fbdf7..35d64ad7d5 100644 --- a/Bugzilla/BugUrl/WebCompat.pm +++ b/Bugzilla/BugUrl/WebCompat.pm @@ -23,7 +23,7 @@ sub should_handle { # https://webcompat.com/issues/1111 my $host = lc($uri->authority); return ($host eq 'webcompat.com' || $host eq 'www.webcompat.com') - && $uri->path =~ m#^/issues/\d+$#; + && $uri->path =~ m#^/issues/\d+$#a; } sub _check_value { diff --git a/Bugzilla/CGI.pm b/Bugzilla/CGI.pm index 284a06faa6..5c9818ccbb 100644 --- a/Bugzilla/CGI.pm +++ b/Bugzilla/CGI.pm @@ -151,7 +151,7 @@ sub canonicalize_query { # Remove the Boolean Charts for standard query.cgi fields # They are listed in the query URL already - next if $key =~ /^(field|type|value)(-\d+){3}$/; + next if $key =~ /^(field|type|value)(-\d+){3}$/a; my $esc_key = url_quote($key); @@ -183,7 +183,7 @@ sub clean_search_url { # Custom Search stuff is empty if it's "noop". We also keep around # the old Boolean Chart syntax for backwards-compatibility. - if ( ($param =~ /\d-\d-\d/ || $param =~ /^[[:alpha:]]\d+$/) + if ( ($param =~ /\d-\d-\d/a || $param =~ /^[[:alpha:]]\d+$/a) && defined $self->param($param) && $self->param($param) eq 'noop') { @@ -192,7 +192,7 @@ sub clean_search_url { # Any "join" for custom search that's an AND can be removed, because # that's the default. - if (($param =~ /^j\d+$/ || $param eq 'j_top') && $self->param($param) eq 'AND') + if (($param =~ /^j\d+$/a || $param eq 'j_top') && $self->param($param) eq 'AND') { $self->delete($param); } diff --git a/Bugzilla/Chart.pm b/Bugzilla/Chart.pm index e97ac60e12..9a66425fe8 100644 --- a/Bugzilla/Chart.pm +++ b/Bugzilla/Chart.pm @@ -62,7 +62,7 @@ sub init { foreach my $param ($cgi->param()) { # Store all the lines - if ($param =~ /^line(\d+)$/) { + if ($param =~ /^line(\d+)$/a) { foreach my $series_id ($cgi->param($param)) { detaint_natural($series_id) || ThrowCodeError("invalid_series_id"); my $series = new Bugzilla::Series($series_id); @@ -71,7 +71,7 @@ sub init { } # Store all the labels - if ($param =~ /^label(\d+)$/) { + if ($param =~ /^label(\d+)$/a) { $self->{'labels'}[$1] = $cgi->param($param); } } diff --git a/Bugzilla/Comment.pm b/Bugzilla/Comment.pm index 2181c9b6b2..e5f4f8bd2e 100644 --- a/Bugzilla/Comment.pm +++ b/Bugzilla/Comment.pm @@ -466,7 +466,7 @@ sub _check_tag { and ThrowUserError('comment_tag_too_short', {tag => $tag}); length($tag) > MAX_COMMENT_TAG_LENGTH and ThrowUserError('comment_tag_too_long', {tag => $tag}); - $tag =~ /^[\w\d\._-]+$/ or ThrowUserError('comment_tag_invalid', {tag => $tag}); + $tag =~ /^[\w\._-]+$/ or ThrowUserError('comment_tag_invalid', {tag => $tag}); return $tag; } diff --git a/Bugzilla/Config/Common.pm b/Bugzilla/Config/Common.pm index 3d894ac59b..e232bc0246 100644 --- a/Bugzilla/Config/Common.pm +++ b/Bugzilla/Config/Common.pm @@ -310,7 +310,7 @@ sub check_maxattachmentsize { sub check_notification { my $option = shift; my @current_version - = (BUGZILLA_VERSION =~ m/^(\d+)\.(\d+)(?:(rc|\.)(\d+))?\+?$/); + = (BUGZILLA_VERSION =~ m/^(\d+)\.(\d+)(?:(rc|\.)(\d+))?\+?$/a); if ($current_version[1] % 2 && $option eq 'stable_branch_release') { return "You are currently running a development snapshot, and so your " diff --git a/Bugzilla/DB/Oracle.pm b/Bugzilla/DB/Oracle.pm index e49e7ff1b4..9e8c16e72d 100644 --- a/Bugzilla/DB/Oracle.pm +++ b/Bugzilla/DB/Oracle.pm @@ -320,7 +320,7 @@ sub adjust_statement { # Oracle doesn't have LIMIT, so if we find the LIMIT comment, wrap the # query with "SELECT * FROM (...) WHERE rownum < $limit" - my ($limit, $offset) = ($part =~ m{/\* LIMIT (\d*) (\d*) \*/}o); + my ($limit, $offset) = ($part =~ m{/\* LIMIT (\d*) (\d*) \*/}ao); push @result, $part; while (@parts) { @@ -351,11 +351,11 @@ sub adjust_statement { $nonstring =~ s/\bAS\b//ig; # Take the first 4000 chars for comparison - $nonstring =~ s/\(\s*(longdescs_\d+\.thetext|attachdata_\d+\.thedata)/ + $nonstring =~ s/\(\s*(longdescs_(?a:\d+)\.thetext|attachdata_(?a:\d+)\.thedata)/ \(DBMS_LOB.SUBSTR\($1, 4000, 1\)/ig; # Look for a LIMIT clause - ($limit) = ($nonstring =~ m(/\* LIMIT (\d*) \*/)o); + ($limit) = ($nonstring =~ m(/\* LIMIT (\d*) \*/)ao); if (!length($string)) { push @result, EMPTY_STRING; diff --git a/Bugzilla/DB/Pg.pm b/Bugzilla/DB/Pg.pm index f6e09a3da0..7afbee109d 100644 --- a/Bugzilla/DB/Pg.pm +++ b/Bugzilla/DB/Pg.pm @@ -188,7 +188,7 @@ sub bz_check_server_version { my $self = shift; my ($db) = @_; my $server_version = $self->SUPER::bz_check_server_version(@_); - my ($major_version, $minor_version) = $server_version =~ /^0*(\d+)\.0*(\d+)/; + my ($major_version, $minor_version) = $server_version =~ /^0*(\d+)\.0*(\d+)/a; # Pg 9.0 requires DBD::Pg 2.17.2 in order to properly read bytea values. # Pg 9.2 requires DBD::Pg 2.19.3 as spclocation no longer exists. diff --git a/Bugzilla/DB/Schema/MariaDB.pm b/Bugzilla/DB/Schema/MariaDB.pm index 1ec12e5665..7d9e8ecf65 100644 --- a/Bugzilla/DB/Schema/MariaDB.pm +++ b/Bugzilla/DB/Schema/MariaDB.pm @@ -366,7 +366,7 @@ sub column_info_to_column { # If we're not a number, we're a string and need to be # quoted. - $default = $dbh->quote($default) if !($default =~ /^(-)?(\d+)(.\d+)?$/); + $default = $dbh->quote($default) if !($default =~ /^(-)?(\d+)(.\d+)?$/a); $column->{DEFAULT} = $default; } } diff --git a/Bugzilla/DB/Schema/Mysql.pm b/Bugzilla/DB/Schema/Mysql.pm index 86d9ac44cb..3a807e07f9 100644 --- a/Bugzilla/DB/Schema/Mysql.pm +++ b/Bugzilla/DB/Schema/Mysql.pm @@ -366,7 +366,7 @@ sub column_info_to_column { # If we're not a number, we're a string and need to be # quoted. - $default = $dbh->quote($default) if !($default =~ /^(-)?(\d+)(.\d+)?$/); + $default = $dbh->quote($default) if !($default =~ /^(-)?(\d+)(.\d+)?$/a); $column->{DEFAULT} = $default; } } diff --git a/Bugzilla/Error.pm b/Bugzilla/Error.pm index b5f82efd82..e779714697 100644 --- a/Bugzilla/Error.pm +++ b/Bugzilla/Error.pm @@ -217,7 +217,7 @@ sub ThrowTemplateError { $vars->{'template_error_msg'} = $template_err; $vars->{'error'} = "template_error"; - $vars->{'template_error_msg'} =~ s/ at \S+ line \d+\.\s*$//; + $vars->{'template_error_msg'} =~ s/ at \S+ line (?a:\d+)\.\s*$//; my $template = Bugzilla->template; diff --git a/Bugzilla/Extension.pm b/Bugzilla/Extension.pm index 52895b84e3..ff73082abd 100644 --- a/Bugzilla/Extension.pm +++ b/Bugzilla/Extension.pm @@ -81,7 +81,7 @@ sub load { } else { my $name = require $config_file; - if ($name =~ /^\d+$/) { + if ($name =~ /^\d+$/a) { ThrowCodeError('extension_must_return_name', {extension => $config_file, returned => $name}); } @@ -94,7 +94,7 @@ sub load { } else { my $name = require $extension_file; - if ($name =~ /^\d+$/) { + if ($name =~ /^\d+$/a) { ThrowCodeError('extension_must_return_name', {extension => $extension_file, returned => $name}); } diff --git a/Bugzilla/Flag.pm b/Bugzilla/Flag.pm index 767a373475..b272b21a5c 100644 --- a/Bugzilla/Flag.pm +++ b/Bugzilla/Flag.pm @@ -859,7 +859,7 @@ sub extract_flags_from_cgi { my $match_status = Bugzilla::User::match_field( - {'^requestee(_type)?-(\d+)$' => {'type' => 'multi'},}, + {'(?a:^requestee(_type)?-(\d+)$)' => {'type' => 'multi'},}, undef, $skip); $vars->{'match_field'} = 'requestee'; @@ -871,10 +871,10 @@ sub extract_flags_from_cgi { } # Extract a list of flag type IDs from field names. - my @flagtype_ids = map(/^flag_type-(\d+)$/ ? $1 : (), $cgi->param()); + my @flagtype_ids = map(/^flag_type-(\d+)$/a ? $1 : (), $cgi->param()); # Extract a list of existing flag IDs. - my @flag_ids = map(/^flag-(\d+)$/ ? $1 : (), $cgi->param()); + my @flag_ids = map(/^flag-(\d+)$/a ? $1 : (), $cgi->param()); return ([], []) unless (scalar(@flagtype_ids) || scalar(@flag_ids)); diff --git a/Bugzilla/FlagType.pm b/Bugzilla/FlagType.pm index d2143db413..4b4455443e 100644 --- a/Bugzilla/FlagType.pm +++ b/Bugzilla/FlagType.pm @@ -696,7 +696,7 @@ sub sqlify_criteria { push(@criteria, "flagtypes.is_active = $is_active"); } if (exists($criteria->{active_or_has_flags}) - && $criteria->{active_or_has_flags} =~ /^\d+$/) + && $criteria->{active_or_has_flags} =~ /^\d+$/a) { push(@$tables, "LEFT JOIN flags AS f ON flagtypes.id = f.type_id " diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm index 093147d337..a2560ed8e6 100644 --- a/Bugzilla/Install/DB.pm +++ b/Bugzilla/Install/DB.pm @@ -970,7 +970,7 @@ sub _populate_longdescs { my $buffer = ""; foreach my $line (split(/\n/, $desc)) { $line =~ s/\s+$//g; # Trim trailing whitespace. - if ($line =~ /^------- Additional Comments From ([^\s]+)\s+(\d.+\d)\s+-------$/) + if ($line =~ /^------- Additional Comments From ([^\s]+)\s+((?a:\d.+\d))\s+-------$/) { my $name = $1; my $date = str2time($2); @@ -1223,7 +1223,7 @@ sub _populate_milestones_table { # check if the value already exists my $sortkey = substr($value, 1); - if ($sortkey !~ /^\d+$/) { + if ($sortkey !~ /^\d+$/a) { $sortkey = 0; } else { @@ -1324,7 +1324,7 @@ sub _populate_duplicates_table { foreach $key (keys(%dupes)) { $dupes{$key} - =~ /^.*\*\*\* This bug has been marked as a duplicate of (\d+) \*\*\*$/ms; + =~ /^.*\*\*\* This bug has been marked as a duplicate of (\d+) \*\*\*$/ams; $dupes{$key} = $1; $dbh->do("INSERT INTO duplicates VALUES(?, ?)", undef, $dupes{$key}, $key); @@ -2380,7 +2380,7 @@ sub _copy_old_charts_into_database { my @lines = <$in>; while (my $line = shift @lines) { - if ($line =~ /^(\d+\|.*)/) { + if ($line =~ /^(\d+\|.*)/a) { my @numbers = split(/\||\r/, $1); # Only take the first line for each date; it was possible to @@ -3667,7 +3667,7 @@ sub _fix_illegal_flag_modification_dates { # If no rows are affected, $dbh->do returns 0E0 instead of 0. print "$rows flags had an illegal modification date. Fixed!\n" - if ($rows =~ /^\d+$/); + if ($rows =~ /^\d+$/a); } sub _add_visibility_value_to_value_tables { @@ -3766,7 +3766,7 @@ sub _set_attachment_comment_type { foreach my $id (@comment_ids) { $count++; my $text = $comments{$id}; - next if $text !~ /^\Q$string\E(\d+)/; + next if $text !~ /^\Q$string\E(\d+)/a; my $attachment_id = $1; my @lines = split("\n", $text); if ($type == CMT_ATTACHMENT_CREATED) { diff --git a/Bugzilla/Install/Filesystem.pm b/Bugzilla/Install/Filesystem.pm index 319aa9ea63..894779fb67 100644 --- a/Bugzilla/Install/Filesystem.pm +++ b/Bugzilla/Install/Filesystem.pm @@ -579,7 +579,7 @@ sub _update_old_charts { @declared_fields = map uc, (split /\||\r/, $1); print OUT "# fields: ", join('|', @out_fields), "\n"; } - elsif (/^(\d+\|.*)/) { + elsif (/^(\d+\|.*)/a) { my @data = split(/\||\r/, $1); my %data; if (@data == @declared_fields) { diff --git a/Bugzilla/Install/Util.pm b/Bugzilla/Install/Util.pm index 2839576d86..3adc14151f 100644 --- a/Bugzilla/Install/Util.pm +++ b/Bugzilla/Install/Util.pm @@ -361,11 +361,11 @@ sub vers_cmp { my ($a, $b) = @_; # Remove leading zeroes - Bug 344661 - $a =~ s/^0*(\d.+)/$1/; - $b =~ s/^0*(\d.+)/$1/; + $a =~ s/^0*(\d.+)/$1/a; + $b =~ s/^0*(\d.+)/$1/a; - my @A = ($a =~ /([-.]|\d+|[^-.\d]+)/g); - my @B = ($b =~ /([-.]|\d+|[^-.\d]+)/g); + my @A = ($a =~ /([-.]|\d+|[^-.\d]+)/ag); + my @B = ($b =~ /([-.]|\d+|[^-.\d]+)/ag); my ($A, $B); while (@A and @B) { @@ -389,7 +389,7 @@ sub vers_cmp { elsif ($B eq '.') { return 1; } - elsif ($A =~ /^\d+$/ and $B =~ /^\d+$/) { + elsif ($A =~ /^\d+$/a and $B =~ /^\d+$/a) { if ($A =~ /^0/ || $B =~ /^0/) { return $A cmp $B if $A cmp $B; } @@ -449,7 +449,7 @@ sub _sort_accept_language { my @qlanguages; my @languages; foreach (split /,/, $accept_language) { - if (m/([A-Za-z\-]+)(?:;q=(\d(?:\.\d+)))?/) { + if (m/([A-Za-z\-]+)(?:;q=(\d(?:\.\d+)))?/a) { my $lang = $1; my $qvalue = $2; $qvalue = 1 if not defined $qvalue; diff --git a/Bugzilla/Mailer.pm b/Bugzilla/Mailer.pm index c63659a085..b5f1adc8d1 100644 --- a/Bugzilla/Mailer.pm +++ b/Bugzilla/Mailer.pm @@ -267,7 +267,7 @@ sub build_thread_marker { $sitespec = "-$path$sitespec"; } - if ($sitespec =~ s/^([^:\/]+):(\d+)/$1/) { # Remove port number, to relocate + if ($sitespec =~ s/^([^:\/]+):(\d+)/$1/a) { # Remove port number, to relocate $sitespec = "-$2$sitespec"; # Put the port number back in, before the '@' } @@ -304,7 +304,7 @@ sub build_message_id { $sitespec = "-$path$sitespec"; } - if ($sitespec =~ s/^([^:\/]+):(\d+)/$1/) { # Remove port number, to relocate + if ($sitespec =~ s/^([^:\/]+):(\d+)/$1/a) { # Remove port number, to relocate $sitespec = "-$2$sitespec"; # Put the port number back in, before the '@' } diff --git a/Bugzilla/Migrate/Gnats.pm b/Bugzilla/Migrate/Gnats.pm index 5f7429a70e..5bd4ad8004 100644 --- a/Bugzilla/Migrate/Gnats.pm +++ b/Bugzilla/Migrate/Gnats.pm @@ -321,7 +321,7 @@ sub _parse_project { $self->debug("Reading Project: $directory"); # Sometimes other files get into gnats directories. - @files = grep { basename($_) =~ /^\d+$/ } @files; + @files = grep { basename($_) =~ /^\d+$/a } @files; my @bugs; my $count = 1; my $total = scalar @files; @@ -699,7 +699,7 @@ sub translate_value { # is longer than 32 characters, pull out the first thing that looks # like a version number. elsif (length($value) > LONG_VERSION_LENGTH) { - $value =~ s/^.+?\b(\d[\w\.]+)\b.+$/$1/; + $value =~ s/^.+?\b((?a:\d)[\w\.]+)\b.+$/$1/; } } diff --git a/Bugzilla/Object.pm b/Bugzilla/Object.pm index 95c184ca00..d72c018ca1 100644 --- a/Bugzilla/Object.pm +++ b/Bugzilla/Object.pm @@ -810,7 +810,7 @@ sub _validate_time { # regexp verifies one or more digits, optionally followed by a period and # zero or more digits, OR we have a period followed by one or more digits # (allow negatives, though, so people can back out errors in time reporting) - if ($time !~ /^-?(?:\d+(?:\.\d*)?|\.\d+)$/) { + if ($time !~ /^-?(?:\d+(?:\.\d*)?|\.\d+)$/a) { ThrowUserError("number_not_numeric", {field => $field, num => "$time"}); } diff --git a/Bugzilla/PatchReader/Raw.pm b/Bugzilla/PatchReader/Raw.pm index 38e6cc38bb..19c43afc78 100644 --- a/Bugzilla/PatchReader/Raw.pm +++ b/Bugzilla/PatchReader/Raw.pm @@ -99,7 +99,7 @@ sub next_line { # section parsing } - elsif ($line =~ /^@@\s*-(\d+),?(\d*)\s*\+(\d+),?(\d*)\s*(?:@@\s*(.*))?/) { + elsif ($line =~ /^@@\s*-(\d+),?(\d*)\s*\+(\d+),?(\d*)\s*(?:@@\s*(.*))?/a) { $this->{IN_HEADER} = 0; $this->_maybe_start_file(); @@ -117,7 +117,7 @@ sub next_line { }; } - elsif ($line =~ /^(\d+),?(\d*)([acd])(\d+),?(\d*)/) { + elsif ($line =~ /^(\d+),?(\d*)([acd])(\d+),?(\d*)/a) { # Non-universal diff. Calculate as though it were universal. $this->{IN_HEADER} = 0; diff --git a/Bugzilla/RNG.pm b/Bugzilla/RNG.pm index 6a4110707b..d671f91431 100644 --- a/Bugzilla/RNG.pm +++ b/Bugzilla/RNG.pm @@ -131,7 +131,7 @@ sub _check_seed { # If it looks like we were seeded with a 32-bit integer, warn the # user that they are making a dangerous, easily-crackable mistake. - elsif (length($seed) <= 10 and $seed =~ /^\d+$/) { + elsif (length($seed) <= 10 and $seed =~ /^\d+$/a) { warn "RNG seeded with a 32-bit integer, this is easy to crack"; } } diff --git a/Bugzilla/S3.pm b/Bugzilla/S3.pm index e769154037..7eb9b4d955 100644 --- a/Bugzilla/S3.pm +++ b/Bugzilla/S3.pm @@ -181,7 +181,7 @@ sub _send_request_expect_nothing { my $response = $self->_do_http($request); my $content = $response->content; - return 1 if $response->code =~ /^2\d\d$/; + return 1 if $response->code =~ /^2\d\d$/a; # anything else is a failure, and we save the parsed result $self->_remember_errors($response->content); @@ -217,7 +217,7 @@ sub _send_request_expect_nothing_probed { my $content = $response->content; - return 1 if $response->code =~ /^2\d\d$/; + return 1 if $response->code =~ /^2\d\d$/a; # anything else is a failure, and we save the parsed result $self->_remember_errors($response->content); @@ -226,7 +226,7 @@ sub _send_request_expect_nothing_probed { sub _check_response { my ($self, $response) = @_; - return 1 if $response->code =~ /^2\d\d$/; + return 1 if $response->code =~ /^2\d\d$/a; $self->err("network_error"); $self->errstr($response->status_line); $self->_remember_errors($response->content); @@ -235,7 +235,7 @@ sub _check_response { sub _croak_if_response_error { my ($self, $response) = @_; - unless ($response->code =~ /^2\d\d$/) { + unless ($response->code =~ /^2\d\d$/a) { $self->err("network_error"); $self->errstr($response->status_line); croak "Bugzilla::S3: Amazon responded with " . $response->status_line . "\n"; diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index 529d297ee0..d16ab46a02 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -133,7 +133,7 @@ use constant NUMBER_REGEX => qr/ \d+ )? $ -/x; + /ax; # If you specify a search type in the boolean charts, this describes # which operator maps to which internal function here. @@ -1701,7 +1701,7 @@ sub _special_parse_chfield { # chfieldto is supposed to be a relative date or a date of the form # YYYY-MM-DD, i.e. without the time appended to it. We append the # time ourselves so that the end date is correctly taken into account. - $date_to .= ' 23:59:59' if $date_to =~ /^\d{4}-\d{1,2}-\d{1,2}$/; + $date_to .= ' 23:59:59' if $date_to =~ /^\d{4}-\d{1,2}-\d{1,2}$/a; my $join_clause = new Bugzilla::Search::Clause('OR'); @@ -1739,11 +1739,11 @@ sub _special_parse_email { my ($self) = @_; my $params = $self->_params; - my @email_params = grep { $_ =~ /^email\d+$/ } keys %$params; + my @email_params = grep { $_ =~ /^email\d+$/a } keys %$params; my $clause = new Bugzilla::Search::Clause(); foreach my $param (@email_params) { - $param =~ /(\d+)$/; + $param =~ /(\d+)$/a; my $id = $1; my $email = trim($params->{"email$id"}); next if !$email; @@ -1846,20 +1846,20 @@ sub _boolean_charts { my $params = $self->_params; my @param_list = keys %$params; - my @all_field_params = grep {/^field-?\d+/} @param_list; - my @chart_ids = map { /^field(-?\d+)/; $1 } @all_field_params; + my @all_field_params = grep {/^field-?\d+/a} @param_list; + my @chart_ids = map { /^field(-?\d+)/a; $1 } @all_field_params; @chart_ids = sort { $a <=> $b } uniq @chart_ids; my $clause = new Bugzilla::Search::Clause(); foreach my $chart_id (@chart_ids) { - my @all_and = grep {/^field$chart_id-\d+/} @param_list; - my @and_ids = map { /^field$chart_id-(\d+)/; $1 } @all_and; + my @all_and = grep {/^field$chart_id-\d+/a} @param_list; + my @and_ids = map { /^field$chart_id-(\d+)/a; $1 } @all_and; @and_ids = sort { $a <=> $b } uniq @and_ids; my $and_clause = new Bugzilla::Search::Clause(); foreach my $and_id (@and_ids) { - my @all_or = grep {/^field$chart_id-$and_id-\d+/} @param_list; - my @or_ids = map { /^field$chart_id-$and_id-(\d+)/; $1 } @all_or; + my @all_or = grep {/^field$chart_id-$and_id-\d+/a} @param_list; + my @or_ids = map { /^field$chart_id-$and_id-(\d+)/a; $1 } @all_or; @or_ids = sort { $a <=> $b } uniq @or_ids; my $or_clause = new Bugzilla::Search::Clause('OR'); @@ -1933,8 +1933,8 @@ sub _field_ids { my $params = $self->_params; my @param_list = keys %$params; - my @field_params = grep {/^f\d+$/} @param_list; - my @field_ids = map { /(\d+)/; $1 } @field_params; + my @field_params = grep {/^f\d+$/a} @param_list; + my @field_ids = map { /(\d+)/a; $1 } @field_params; @field_ids = sort { $a <=> $b } @field_ids; return @field_ids; } @@ -2267,7 +2267,7 @@ sub _timestamp_translate { my $value = $args->{value}; my $dbh = Bugzilla->dbh; - return if $value !~ /^(?:[\+\-]?\d+[hdwmy]s?|now)$/i && $value !~ /^%\w+%$/; + return if $value !~ /^(?:[\+\-]?\d+[hdwmy]s?|now)$/ai && $value !~ /^%\w+%$/; $value = SqlifyDate($value); @@ -2320,7 +2320,7 @@ sub SqlifyDate { return $pronoun->{date}; } - if ($str =~ /^(-|\+)?(\d+)([hdwmy])(s?)$/i) { # relative date + if ($str =~ /^(-|\+)?(\d+)([hdwmy])(s?)$/ai) { # relative date my ($sign, $amount, $unit, $startof, $date) = ($1, $2, lc $3, lc $4, time); my ($sec, $min, $hour, $mday, $month, $year, $wday) = localtime($date); if ($sign && $sign eq '+') { $amount = -$amount; } diff --git a/Bugzilla/Search/Quicksearch.pm b/Bugzilla/Search/Quicksearch.pm index bd7064985d..7b0a768ad3 100644 --- a/Bugzilla/Search/Quicksearch.pm +++ b/Bugzilla/Search/Quicksearch.pm @@ -585,7 +585,7 @@ sub _special_field_syntax { return unless defined($word); # P1-5 Syntax - if ($word =~ m/^P(\d+)(?:-(\d+))?$/i) { + if ($word =~ m/^P(\d+)(?:-(\d+))?$/ai) { my ($p_start, $p_end) = ($1, $2); my $legal_priorities = get_legal_field_values('priority'); diff --git a/Bugzilla/Search/Saved.pm b/Bugzilla/Search/Saved.pm index 868f74b816..18875a23b2 100644 --- a/Bugzilla/Search/Saved.pm +++ b/Bugzilla/Search/Saved.pm @@ -186,7 +186,7 @@ sub rename_field_value { $query =~ s/\b$field=\Q$old\E\b/$field=$new/gi; # Fix boolean charts. - while ($query =~ /\bfield(\d+-\d+-\d+)=\Q$field\E\b/gi) { + while ($query =~ /\bfield(?a:(\d+-\d+-\d+))=\Q$field\E\b/gi) { my $chart_id = $1; # Note that this won't handle lists or substrings inside of diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index dd427998b6..353a0191ea 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -229,7 +229,7 @@ sub quoteUrls { # attachment links # BMO: don't make diff view the default for patches (Bug 652332) - $text =~ s~\b(attachment$s*\#?$s*(\d+)(?:$s+\[diff\])?(?:\s+\[details\])?) + $text =~ s~\b(attachment$s*\#?$s*((?a:\d+))(?:$s+\[diff\])?(?:\s+\[details\])?) ~($things[$count++] = get_attachment_link($2, $1, $user)) && ("\x{FDD2}" . ($count-1) . "\x{FDD3}") ~egmxi; @@ -239,8 +239,8 @@ sub quoteUrls { # Also, we can't use $bug_re?$comment_re? because that will match the # empty string my $bug_word = template_var('terms')->{bug}; - my $bug_re = qr/\Q$bug_word\E$s*\#?$s*(\d+)/i; - my $comment_re = qr/comment$s*\#?$s*(\d+)/i; + my $bug_re = qr/\Q$bug_word\E$s*\#?$s*((?a:\d+))/i; + my $comment_re = qr/comment$s*\#?$s*((?a:\d+))/i; $text =~ s~\b($bug_re(?:$s*,?$s*$comment_re)?|$comment_re) ~ # We have several choices. $1 here is the link, and $2-4 are set # depending on which part matched @@ -251,7 +251,7 @@ sub quoteUrls { # Old duplicate markers. These don't use $bug_word because they are old # and were never customizable. $text =~ s~(?<=^\*\*\*\ This\ bug\ has\ been\ marked\ as\ a\ duplicate\ of\ ) - (\d+) + ((?a:\d+)) (?=\ \*\*\*\Z) ~$bug_link_func->($1, $1, { user => $user }) ~egmx; @@ -794,7 +794,7 @@ sub create { # so we do not allow it to happen. We only do this for logged-in users. $var =~ s/\\/\x{FF3C}/g if Bugzilla->user->id; $var =~ s/\"/\"\"/g; - if ($var !~ /^-?(\d+\.)?\d*$/) { + if ($var !~ /^-?(\d+\.)?\d*$/a) { $var = "\"$var\""; } return $var; @@ -930,7 +930,7 @@ sub create { 'bugzilla_version' => sub { my $version = Bugzilla->VERSION; - if (my @ver = $version =~ /^(\d{4})(\d{2})(\d{2})\.(\d+)$/s) { + if (my @ver = $version =~ /^(\d{4})(\d{2})(\d{2})\.(\d+)$/as) { if ($ver[3] eq '1') { return join('.', @ver[0, 1, 2]); } diff --git a/Bugzilla/Update.pm b/Bugzilla/Update.pm index 239a2fd929..503fa0bf2b 100644 --- a/Bugzilla/Update.pm +++ b/Bugzilla/Update.pm @@ -60,7 +60,7 @@ sub get_notifications { # On which branch is the current installation running? my @current_version - = (BUGZILLA_VERSION =~ m/^(\d+)\.(\d+)(?:(rc|\.)(\d+))?\+?$/); + = (BUGZILLA_VERSION =~ m/^(\d+)\.(\d+)(?:(rc|\.)(\d+))?\+?$/a); my @release; if (Bugzilla->params->{'upgrade_notification'} eq 'development_snapshot') { @@ -144,7 +144,7 @@ sub get_notifications { # Only notify the administrator if the latest version available # is newer than the current one. my @new_version - = ($release[0]->{'latest_ver'} =~ m/^(\d+)\.(\d+)(?:(rc|\.)(\d+))?\+?$/); + = ($release[0]->{'latest_ver'} =~ m/^(\d+)\.(\d+)(?:(rc|\.)(\d+))?\+?$/a); # We convert release candidates 'rc' to integers (rc ? 0 : 1) in order # to compare versions easily. diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index 13e592ed74..c291e4edb5 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -570,7 +570,7 @@ sub _set_groups_to_object { # Go through the array, and turn items into group objects my @groups = (); foreach my $value (@{$changes->{$key}}) { - my $type = $value =~ /^\d+$/ ? 'id' : 'name'; + my $type = $value =~ /^\d+$/a ? 'id' : 'name'; my $group = Bugzilla::Group->new({$type => $value}); if (!$group || !$user->can_bless($group->id)) { @@ -2122,7 +2122,7 @@ sub match_field { # The field is a requestee field; in order for its name # to show up correctly on the confirmation page, we need # to find out the name of its flag type. - if ($field_name =~ /^requestee(_type)?-(\d+)$/) { + if ($field_name =~ /^requestee(_type)?-(\d+)$/a) { my $flag_type; if ($1) { require Bugzilla::FlagType; diff --git a/Bugzilla/Util.pm b/Bugzilla/Util.pm index d0d76307d2..031aab8445 100644 --- a/Bugzilla/Util.pm +++ b/Bugzilla/Util.pm @@ -76,13 +76,13 @@ sub with_readonly_database(&) { } sub detaint_natural { - my $match = $_[0] =~ /^(\d+)$/; + my $match = $_[0] =~ /^(\d+)$/a; $_[0] = $match ? int($1) : undef; return (defined($_[0])); } sub detaint_signed { - my $match = $_[0] =~ /^([-+]?\d+)$/; + my $match = $_[0] =~ /^([-+]?\d+)$/a; # The "int()" call removes any leading plus sign. $_[0] = $match ? int($1) : undef; @@ -307,7 +307,7 @@ sub is_webserver_group { $web_server_gid = $effective_gids[0]; } - elsif ($web_server_group =~ /^\d+$/) { + elsif ($web_server_group =~ /^\d+$/a) { $web_server_gid = $web_server_group; } @@ -348,11 +348,11 @@ sub is_ipv4 { my $ip = shift; return unless defined $ip; - my @octets = $ip =~ /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/; + my @octets = $ip =~ /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/a; return unless scalar(@octets) == 4; foreach my $octet (@octets) { - return unless ($octet >= 0 && $octet <= 255 && $octet !~ /^0\d{1,2}$/); + return unless ($octet >= 0 && $octet <= 255 && $octet !~ /^0\d{1,2}$/a); } # The IP address is valid and can now be detainted. @@ -551,7 +551,7 @@ sub format_time { # If $format is not set, try to guess the correct date format. if (!$format) { if (!ref $date - && $date =~ /^(\d{4})[-\.](\d{2})[-\.](\d{2}) (\d{2}):(\d{2})(:(\d{2}))?$/) + && $date =~ /^(\d{4})[-\.](\d{2})[-\.](\d{2}) (\d{2}):(\d{2})(:(\d{2}))?$/a) { my $sec = $7; if (defined $sec) { @@ -584,7 +584,7 @@ sub datetime_from { my @time; # Most dates will be in this format, avoid strptime's generic parser - if ($date =~ /^(\d{4})[\.-](\d{2})[\.-](\d{2})(?: (\d{2}):(\d{2}):(\d{2}))?$/) { + if ($date =~ /^(\d{4})[\.-](\d{2})[\.-](\d{2})(?: (\d{2}):(\d{2}):(\d{2}))?$/a) { @time = ($6, $5, $4, $3, $2 - 1, $1 - 1900, undef); } else { @@ -766,8 +766,8 @@ sub validate_date { if ($ts) { $date2 = time2str("%Y-%m-%d", $ts); - $date =~ s/(\d+)-0*(\d+?)-0*(\d+?)/$1-$2-$3/; - $date2 =~ s/(\d+)-0*(\d+?)-0*(\d+?)/$1-$2-$3/; + $date =~ s/(\d+)-0*(\d+?)-0*(\d+?)/$1-$2-$3/a; + $date2 =~ s/(\d+)-0*(\d+?)-0*(\d+?)/$1-$2-$3/a; } my $ret = ($ts && $date eq $date2); return $ret ? 1 : 0; @@ -781,7 +781,7 @@ sub validate_time { my $ts = str2time($time); if ($ts) { $time2 = time2str("%H:%M:%S", $ts); - if ($time =~ /^(\d{1,2}):(\d\d)(?::(\d\d))?$/) { + if ($time =~ /^(\d{1,2}):(\d\d)(?::(\d\d))?$/a) { $time = sprintf("%02d:%02d:%02d", $1, $2, $3 || 0); } } @@ -949,7 +949,7 @@ sub extract_nicks { $name =~ / # This negative lookbehind lets us # match colons that are not followed by numbers. - (?visible_bugs(\@int); } @@ -460,7 +460,7 @@ sub get { # Cache permissions for bugs. This highly reduces the number of calls to the DB. # visible_bugs() is only able to handle bug IDs, so we have to skip aliases. - my @int = grep { $_ =~ /^\d+$/ } @$ids; + my @int = grep { $_ =~ /^\d+$/a } @$ids; Bugzilla->user->visible_bugs(\@int); foreach my $bug_id (@$ids) { @@ -514,7 +514,7 @@ sub history { # Cache permissions for bugs. This highly reduces the number of calls to the DB. # visible_bugs() is only able to handle bug IDs, so we have to skip aliases. - my @int = grep { $_ =~ /^\d+$/ } @$ids; + my @int = grep { $_ =~ /^\d+$/a } @$ids; $user->visible_bugs(\@int); } @@ -607,7 +607,7 @@ sub search { my %options = (fields => ['bug_id']); # Find the highest custom field id - my @field_ids = grep(/^f(\d+)$/, keys %$match_params); + my @field_ids = grep(/^f(\d+)$/a, keys %$match_params); my $last_field_id = @field_ids ? max @field_ids + 1 : 1; # Do special search types for certain fields. diff --git a/Bugzilla/WebService/Server/REST.pm b/Bugzilla/WebService/Server/REST.pm index 8ded25dda7..616a8c5b64 100644 --- a/Bugzilla/WebService/Server/REST.pm +++ b/Bugzilla/WebService/Server/REST.pm @@ -495,7 +495,7 @@ sub _get_content_prefs { my @accept_types = split /,/, $self->cgi->http('accept') || ''; my $order = 0; for my $accept_type (@accept_types) { - my ($weight) = ($accept_type =~ /q=(\d\.\d+|\d+)/); + my ($weight) = ($accept_type =~ /q=(\d\.\d+|\d+)/a); my ($name) = ($accept_type =~ m#(\S+/[^;]+)#); next unless $name; push @prefs, {name => $name, order => $order++}; diff --git a/Bugzilla/WebService/Server/REST/Resources/Bug.pm b/Bugzilla/WebService/Server/REST/Resources/Bug.pm index 939f114f98..5e5bc80b7d 100644 --- a/Bugzilla/WebService/Server/REST/Resources/Bug.pm +++ b/Bugzilla/WebService/Server/REST/Resources/Bug.pm @@ -60,7 +60,7 @@ sub _rest_resources { success_code => STATUS_CREATED } }, - qr{^/bug/comment/(\d+)$}, + qr{^/bug/comment/(\d+)$}a, { GET => { method => 'comments', @@ -138,7 +138,7 @@ sub _rest_resources { params => sub { my $value = $_[0]; my $param = 'names'; - $param = 'ids' if $value =~ /^\d+$/; + $param = 'ids' if $value =~ /^\d+$/a; return {$param => [$_[0]]}; } } diff --git a/Bugzilla/WebService/Server/REST/Resources/BugUserLastVisit.pm b/Bugzilla/WebService/Server/REST/Resources/BugUserLastVisit.pm index d96bff840d..0975c62250 100644 --- a/Bugzilla/WebService/Server/REST/Resources/BugUserLastVisit.pm +++ b/Bugzilla/WebService/Server/REST/Resources/BugUserLastVisit.pm @@ -18,7 +18,7 @@ BEGIN { sub _rest_resources { return [ # bug-id - qr{^/bug_user_last_visit/(\d+)$}, + qr{^/bug_user_last_visit/(\d+)$}a, { GET => { method => 'get', diff --git a/Bugzilla/WebService/Server/REST/Resources/Classification.pm b/Bugzilla/WebService/Server/REST/Resources/Classification.pm index 0ece4599ec..ac457bbe10 100644 --- a/Bugzilla/WebService/Server/REST/Resources/Classification.pm +++ b/Bugzilla/WebService/Server/REST/Resources/Classification.pm @@ -25,7 +25,7 @@ sub _rest_resources { GET => { method => 'get', params => sub { - my $param = $_[0] =~ /^\d+$/ ? 'ids' : 'names'; + my $param = $_[0] =~ /^\d+$/a ? 'ids' : 'names'; return {$param => [$_[0]]}; } } diff --git a/Bugzilla/WebService/Server/REST/Resources/Group.pm b/Bugzilla/WebService/Server/REST/Resources/Group.pm index cce929409f..b592e34ab1 100644 --- a/Bugzilla/WebService/Server/REST/Resources/Group.pm +++ b/Bugzilla/WebService/Server/REST/Resources/Group.pm @@ -30,14 +30,14 @@ sub _rest_resources { GET => { method => 'get', params => sub { - my $param = $_[0] =~ /^\d+$/ ? 'ids' : 'names'; + my $param = $_[0] =~ /^\d+$/a ? 'ids' : 'names'; return {$param => [$_[0]]}; } }, PUT => { method => 'update', params => sub { - my $param = $_[0] =~ /^\d+$/ ? 'ids' : 'names'; + my $param = $_[0] =~ /^\d+$/a ? 'ids' : 'names'; return {$param => [$_[0]]}; } } diff --git a/Bugzilla/WebService/Server/REST/Resources/Product.pm b/Bugzilla/WebService/Server/REST/Resources/Product.pm index b4ca77b020..7eda2d325a 100644 --- a/Bugzilla/WebService/Server/REST/Resources/Product.pm +++ b/Bugzilla/WebService/Server/REST/Resources/Product.pm @@ -38,14 +38,14 @@ sub _rest_resources { GET => { method => 'get', params => sub { - my $param = $_[0] =~ /^\d+$/ ? 'ids' : 'names'; + my $param = $_[0] =~ /^\d+$/a ? 'ids' : 'names'; return {$param => [$_[0]]}; } }, PUT => { method => 'update', params => sub { - my $param = $_[0] =~ /^\d+$/ ? 'ids' : 'names'; + my $param = $_[0] =~ /^\d+$/a ? 'ids' : 'names'; return {$param => [$_[0]]}; } } diff --git a/Bugzilla/WebService/Server/REST/Resources/User.pm b/Bugzilla/WebService/Server/REST/Resources/User.pm index b5ab024637..06366c9e16 100644 --- a/Bugzilla/WebService/Server/REST/Resources/User.pm +++ b/Bugzilla/WebService/Server/REST/Resources/User.pm @@ -38,14 +38,14 @@ sub _rest_resources { GET => { method => 'get', params => sub { - my $param = $_[0] =~ /^\d+$/ ? 'ids' : 'names'; + my $param = $_[0] =~ /^\d+$/a ? 'ids' : 'names'; return {$param => [$_[0]]}; } }, PUT => { method => 'update', params => sub { - my $param = $_[0] =~ /^\d+$/ ? 'ids' : 'names'; + my $param = $_[0] =~ /^\d+$/a ? 'ids' : 'names'; return {$param => [$_[0]]}; } } diff --git a/buglist.cgi b/buglist.cgi index 6eaa29bce9..b9568564f1 100755 --- a/buglist.cgi +++ b/buglist.cgi @@ -147,7 +147,7 @@ if (my $last_list = $cgi->param('regetlastlist')) { # and order by, since relevance only exists when doing a fulltext search. my $fulltext = 0; if ($cgi->param('content')) { $fulltext = 1 } -my @charts = map(/^field(\d-\d-\d)$/ ? $1 : (), $cgi->param()); +my @charts = map(/^field(\d-\d-\d)$/a ? $1 : (), $cgi->param()); foreach my $chart (@charts) { if ($cgi->param("field$chart") eq 'content' && $cgi->param("value$chart")) { $fulltext = 1; @@ -801,7 +801,7 @@ foreach my $row (@$data) { # Process certain values further (i.e. date format conversion). if ($bug->{'changeddate'}) { $bug->{'changeddate'} - =~ s/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/$1-$2-$3 $4:$5:$6/; + =~ s/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/$1-$2-$3 $4:$5:$6/a; $bug->{'changedtime'} = $bug->{'changeddate'}; # for iCalendar and Atom $bug->{'changeddate'} = DiffDate($bug->{'changeddate'}); diff --git a/chart.cgi b/chart.cgi index d99e504ef1..222d19abaf 100755 --- a/chart.cgi +++ b/chart.cgi @@ -75,7 +75,7 @@ $vars->{'doc_section'} = 'reporting.html#charts'; # encode it in the name, as "action-". Some params even contain the # series_id they apply to (e.g. subscribe, unsubscribe). my @actions = grep(/^action-/, $cgi->param()); -if ($actions[0] && $actions[0] =~ /^action-([^\d]+)(\d*)$/) { +if ($actions[0] && $actions[0] =~ /^action-(?a:([^\d]+)(\d*))$/) { $action = $1; $series_id = $2 if $2; } @@ -233,14 +233,14 @@ exit; # Find any selected series and return either the first or all of them. sub getAndValidateSeriesIDs { - my @series_ids = grep(/^\d+$/, $cgi->param("name")); + my @series_ids = grep(/^\d+$/a, $cgi->param("name")); return wantarray ? @series_ids : $series_ids[0]; } # Return a list of IDs of all the lines selected in the UI. sub getSelectedLines { - my @ids = map { /^select(\d+)$/ ? $1 : () } $cgi->param(); + my @ids = map { /^select(\d+)$/a ? $1 : () } $cgi->param(); return @ids; } diff --git a/editproducts.cgi b/editproducts.cgi index d3193206c1..8bdcc790fa 100755 --- a/editproducts.cgi +++ b/editproducts.cgi @@ -331,7 +331,7 @@ if ($action eq 'updategroupcontrols') { my @now_na = (); my @now_mandatory = (); foreach my $f ($cgi->param()) { - if ($f =~ /^membercontrol_(\d+)$/) { + if ($f =~ /^membercontrol_(\d+)$/a) { my $id = $1; if ($cgi->param($f) == CONTROLMAPNA) { push @now_na, $id; diff --git a/email_in.pl b/email_in.pl index e4ce980e8e..a838befebf 100755 --- a/email_in.pl +++ b/email_in.pl @@ -70,7 +70,7 @@ sub parse_mail { {mail => $input_email, fields => \%fields}); my $summary = $input_email->header('Subject'); - if ($summary =~ /\[\S+ (\d+)\](.*)/i) { + if ($summary =~ /\[\S+ (?a:(\d+))\](.*)/i) { $fields{'bug_id'} = $1; $summary = trim($2); } diff --git a/extensions/AntiSpam/Extension.pm b/extensions/AntiSpam/Extension.pm index d065d45d2b..52e8a9c125 100644 --- a/extensions/AntiSpam/Extension.pm +++ b/extensions/AntiSpam/Extension.pm @@ -28,11 +28,11 @@ our $VERSION = '1'; sub _project_honeypot_blocking { my ($self, $api_key, $login) = @_; my $ip = remote_ip(); - return unless $ip =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/; + return unless $ip =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/a; my $lookup = "$api_key.$4.$3.$2.$1.dnsbl.httpbl.org"; return unless my $packed = gethostbyname($lookup); my $honeypot = inet_ntoa($packed); - return unless $honeypot =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/; + return unless $honeypot =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/a; my ($status, $days, $threat, $type) = ($1, $2, $3, $4); return diff --git a/extensions/BMO/Extension.pm b/extensions/BMO/Extension.pm index 2d67769bd9..5f36be0e30 100644 --- a/extensions/BMO/Extension.pm +++ b/extensions/BMO/Extension.pm @@ -383,7 +383,7 @@ sub parse_bounty_attachment_description { my ($desc) = @_; my %map = (true => 1, false => 0); - my $date = qr/\d{4}-\d{2}-\d{2}/; + my $date = qr/\d{4}-\d{2}-\d{2}/a; $desc =~ m! ^ (? [^,]+) \s*,\s* @@ -714,7 +714,7 @@ sub bug_format_comment { push( @$regexes, { - match => qr/(? qr/(? sub { my $args = shift; my $match = html_quote($args->{matches}->[0]); @@ -728,7 +728,7 @@ sub bug_format_comment { push( @$regexes, { - match => qr/(^|\s)r(\d{4,})\b/, + match => qr/(^|\s)r(\d{4,})\b/a, replace => sub { my $args = shift; my $match = html_quote($args->{matches}->[1]); @@ -865,7 +865,7 @@ sub bug_format_comment { push( @$regexes, { - match => qr/\b(($hgrepos)\s+changeset:?\s+(?:\d+:)?([0-9a-fA-F]{12}))\b/, + match => qr/\b(($hgrepos)\s+changeset:?\s+(?:\d+:)?([0-9a-fA-F]{12}))\b/a, replace => sub { my $args = shift; my $text = html_quote($args->{matches}->[0]); @@ -1061,7 +1061,7 @@ sub _bug_missing_sec_approval { $flags = [grep { $_->name =~ /^cf_status_firefox/ } @$flags]; return 0 unless @$flags; - my $nightly = last_value { $_->name !~ /_esr\d+$/ } @$flags; + my $nightly = last_value { $_->name !~ /_esr\d+$/a } @$flags; my $set = 0; foreach my $flag (@$flags) { my $value = $flag->bug_flag($self->id)->value; @@ -1730,7 +1730,7 @@ sub _log_sent_email { my $subject = $email->header('Subject'); my $bug_id = $email->header('X-Bugzilla-ID'); - if (!$bug_id && $subject =~ /[\[\(]Bug (\d+)/i) { + if (!$bug_id && $subject =~ /[\[\(]Bug (\d+)/ai) { $bug_id = $1; } $bug_id = $bug_id ? "bug-$bug_id" : '-'; @@ -1749,7 +1749,7 @@ sub _log_sent_email { } $message_type ||= $type || '?'; - $subject =~ s/[\[\(]Bug \d+[\]\)]\s*//; + $subject =~ s/[\[\(]Bug \d+[\]\)]\s*//a; _syslog("[bugmail] $recipient ($message_type) $bug_id $subject"); } @@ -2011,7 +2011,7 @@ sub _post_gear_bug { my $bug = $vars->{bug}; my $input = Bugzilla->input_params; - my ($team, $code) = $input->{teamcode} =~ /^(.+?) \((\d+)\)$/; + my ($team, $code) = $input->{teamcode} =~ /^(.+?) \((\d+)\)$/a; my @request = ( "Date Required: $input->{date_required}", "$input->{firstname} $input->{lastname}", @@ -2430,7 +2430,7 @@ sub query_database { $vars->{executed} = 1; # add limit if missing - if ($query !~ /\sLIMIT\s+\d+\s*$/si) { + if ($query !~ /\sLIMIT\s+\d+\s*$/asi) { $query .= ' LIMIT 1000'; $vars->{query} = $query; } @@ -2669,7 +2669,7 @@ sub _get_product_version { # Return major version by default return 0 unless $version; - my ($major_version) = $version =~ /^(\d+)/; + my ($major_version) = $version =~ /^(\d+)/a; return $major_version; } @@ -2809,7 +2809,7 @@ sub app_startup { # (arbitrary) name to a regular expression and a destination. # # The REWRITE_ prefix is only significant because it is removed from the fake - # CGI environment in Bugzilla::App::CGI + # CGI environment in Bugzilla::App::CGI $r->any('/:REWRITE_itrequest' => [REWRITE_itrequest => qr{form[\.:]itrequest}]) ->to('CGI#enter_bug_cgi' => {'product' => 'Infrastructure & Operations', 'format' => 'itrequest'}); diff --git a/extensions/BMO/bin/migrate-bug-type.pl b/extensions/BMO/bin/migrate-bug-type.pl index 807544b69e..7ae9275e7a 100755 --- a/extensions/BMO/bin/migrate-bug-type.pl +++ b/extensions/BMO/bin/migrate-bug-type.pl @@ -160,7 +160,7 @@ my $bug_ids = {defect => [], enhancement => []}; while (my $line = <$fh>) { - if ($line =~ /^(\d+),(\w)/) { + if ($line =~ /^(\d+),(\w)/a) { push(@{$bug_ids->{$2 eq 'e' ? 'enhancement' : 'defect'}}, $1); } } diff --git a/extensions/BMO/bin/migrate-github-pull-requests.pl b/extensions/BMO/bin/migrate-github-pull-requests.pl index 3c85c1f23a..461486b3d8 100755 --- a/extensions/BMO/bin/migrate-github-pull-requests.pl +++ b/extensions/BMO/bin/migrate-github-pull-requests.pl @@ -57,7 +57,7 @@ # check payload my $url = trim($attachment->{thedata}); next if $url =~ /\s/; - next unless $url =~ m#^https://github\.com/[^/]+/[^/]+/pull/\d+\/?$#i; + next unless $url =~ m#^https://github\.com/[^/]+/[^/]+/pull/\d+\/?$#ai; $dbh->bz_start_transaction; diff --git a/extensions/BMO/lib/Data.pm b/extensions/BMO/lib/Data.pm index a5710fef47..8c6e0daba2 100644 --- a/extensions/BMO/lib/Data.pm +++ b/extensions/BMO/lib/Data.pm @@ -40,18 +40,18 @@ my $mozreview_url_re = qr{ | /diff/\#index_header )? $ -}ix; +}aix; sub phabricator_url_re { my $phab_uri = Bugzilla->params->{phabricator_base_uri} || 'https://example.com'; - return qr/^\Q${phab_uri}\ED\d+$/i; + return qr/^\Q${phab_uri}\ED\d+$/ai; } our %autodetect_attach_urls = ( github_pr => { title => 'GitHub Pull Request', - regex => qr#^https://github\.com/[^/]+/[^/]+/pull/\d+/?$#i, + regex => qr#^https://github\.com/[^/]+/[^/]+/pull/\d+/?$#ai, content_type => 'text/x-github-pull-request', can_review => 1, }, diff --git a/extensions/BMO/lib/Reports/ReleaseTracking.pm b/extensions/BMO/lib/Reports/ReleaseTracking.pm index 3e6dd6a9f9..1a052d51e2 100644 --- a/extensions/BMO/lib/Reports/ReleaseTracking.pm +++ b/extensions/BMO/lib/Reports/ReleaseTracking.pm @@ -120,13 +120,13 @@ sub report { if (scalar keys %{$flag_type->inclusions}) { my $inclusions = $flag_type->inclusions; foreach my $key (keys %$inclusions) { - push @inclusion_ids, ($inclusions->{$key} =~ /^(\d+)/); + push @inclusion_ids, ($inclusions->{$key} =~ /^(\d+)/a); } } elsif (scalar keys %{$flag_type->exclusions}) { my $exclusions = $flag_type->exclusions; foreach my $key (keys %$exclusions) { - push @exclusion_ids, ($exclusions->{$key} =~ /^(\d+)/); + push @exclusion_ids, ($exclusions->{$key} =~ /^(\d+)/a); } } else { @@ -347,7 +347,7 @@ sub _parse_query { # date_range -> from_ymd to_ymd my $date_range = shift @query; if ($date_range ne '*') { - $date_range =~ /^(\d\d\d\d)(\d\d)(\d\d)-(\d\d\d\d)(\d\d)(\d\d)$/ + $date_range =~ /^(\d\d\d\d)(\d\d)(\d\d)-(\d\d\d\d)(\d\d)(\d\d)$/a or ThrowUserError('report_invalid_parameter', {name => 'date_range'}); $query->{start_date} = "$1-$2-$3"; $query->{end_date} = "$4-$5-$6"; @@ -361,7 +361,7 @@ sub _parse_query { # product_id my $product_id = shift @query; - $product_id =~ /^(\d+)$/ + $product_id =~ /^(\d+)$/a or ThrowUserError('report_invalid_parameter', {name => 'product_id'}); $query->{product_id} = $1; @@ -374,7 +374,7 @@ sub _parse_query { # fields my @fields; foreach my $field (@query) { - $field =~ /^(\d+)([\-\+])$/ + $field =~ /^(\d+)([\-\+])$/a or ThrowUserError('report_invalid_parameter', {name => 'fields'}); my ($id, $value) = ($1, $2); my $field_obj = Bugzilla::Field->new($id) diff --git a/extensions/BugModal/Extension.pm b/extensions/BugModal/Extension.pm index b0942b2b4b..7c55b69a8c 100644 --- a/extensions/BugModal/Extension.pm +++ b/extensions/BugModal/Extension.pm @@ -93,7 +93,7 @@ sub template_after_create { $id = substr($id, 1); } $id =~ tr/ /-/; - $id =~ s/[^a-z\d\-_:\.]/_/g; + $id =~ s/[^a-z\d\-_:\.]/_/ag; return $id; }; }, diff --git a/extensions/BugModal/lib/ActivityStream.pm b/extensions/BugModal/lib/ActivityStream.pm index eacb148301..c3fe4d88de 100644 --- a/extensions/BugModal/lib/ActivityStream.pm +++ b/extensions/BugModal/lib/ActivityStream.pm @@ -267,7 +267,7 @@ sub _add_activities_to_stream { foreach my $what (qw(removed added)) { my @buglist = split(/[\s,]+/, $change->{$what}); foreach my $id (@buglist) { - if ($id && $id =~ /^\d+$/) { + if ($id && $id =~ /^\d+$/a) { $visible_bug_ids{$id} = 1; } } @@ -282,7 +282,7 @@ sub _add_activities_to_stream { foreach my $value (split(/, /, $change->{$f})) { my ($bug_id) = substr($value, 0, length($url_base)) eq $url_base - ? $value =~ /id=(\d+)$/ + ? $value =~ /id=(\d+)$/a : undef; push @values, {url => $value, bug_id => $bug_id,}; } diff --git a/extensions/BugModal/lib/Util.pm b/extensions/BugModal/lib/Util.pm index 6acb521888..51cad2ffbd 100644 --- a/extensions/BugModal/lib/Util.pm +++ b/extensions/BugModal/lib/Util.pm @@ -24,7 +24,7 @@ sub date_str_to_time { my ($date) = @_; # avoid creating a DateTime object - if ($date =~ /^(\d{4})[\.\-](\d{2})[\.\-](\d{2}) (\d{2}):(\d{2}):(\d{2})$/) { + if ($date =~ /^(\d{4})[\.\-](\d{2})[\.\-](\d{2}) (\d{2}):(\d{2}):(\d{2})$/a) { return timelocal($6, $5, $4, $3, $2 - 1, $1 - 1900); } state $tz //= DateTime::TimeZone->new(name => 'local'); diff --git a/extensions/BugModal/lib/WebService.pm b/extensions/BugModal/lib/WebService.pm index 1be87e8f38..6d7c3f224c 100644 --- a/extensions/BugModal/lib/WebService.pm +++ b/extensions/BugModal/lib/WebService.pm @@ -46,7 +46,7 @@ sub rest_resources { # return all the lazy-loaded data; kept in sync with the UI's # requirements. - qr{^/bug_modal/edit/(\d+)$}, + qr{^/bug_modal/edit/(\d+)$}a, { GET => { method => 'edit', @@ -57,7 +57,7 @@ sub rest_resources { }, # returns pre-formatted HTML, enabling reuse of the user template - qr{^/bug_modal/cc/(\d+)$}, + qr{^/bug_modal/cc/(\d+)$}a, { GET => { method => 'cc', @@ -68,7 +68,7 @@ sub rest_resources { }, # returns fields that require touching when the product is changed - qw{^/bug_modal/new_product/(\d+)$}, + qr{^/bug_modal/new_product/(\d+)$}a, { GET => { method => 'new_product', @@ -244,9 +244,9 @@ sub new_product { $version->{selected} = $true; $selected_version = $version; } - elsif ($current_version =~ /^(\d+) Branch$/ - || $current_version =~ /^Firefox (\d+)$/ - || $current_version =~ /^(\d+)$/) + elsif ($current_version =~ /^(\d+) Branch$/a + || $current_version =~ /^Firefox (\d+)$/a + || $current_version =~ /^(\d+)$/a) { # Firefox, with its three version naming schemes my $branch = $1; diff --git a/extensions/BzAPI/lib/Resources/Bug.pm b/extensions/BzAPI/lib/Resources/Bug.pm index 55ddd92378..eb0feae1c3 100644 --- a/extensions/BzAPI/lib/Resources/Bug.pm +++ b/extensions/BzAPI/lib/Resources/Bug.pm @@ -190,9 +190,9 @@ sub get_bug_count_resource { $names{"row"}{$row}++; $names{"tbl"}{$tbl}++; - $col_isnumeric &&= ($col =~ /^-?\d+(\.\d+)?$/o); - $row_isnumeric &&= ($row =~ /^-?\d+(\.\d+)?$/o); - $tbl_isnumeric &&= ($tbl =~ /^-?\d+(\.\d+)?$/o); + $col_isnumeric &&= ($col =~ /^-?\d+(\.\d+)?$/ao); + $row_isnumeric &&= ($row =~ /^-?\d+(\.\d+)?$/ao); + $tbl_isnumeric &&= ($tbl =~ /^-?\d+(\.\d+)?$/ao); } my @col_names = get_names($names{"col"}, $col_isnumeric, $col_field); @@ -338,7 +338,7 @@ sub search_bugs_request { # First, search types. These are found in the value of any field ending # _type, and the value of any field matching type\d-\d-\d. - if ($key =~ /^type(\d+)-(\d+)-(\d+)$|_type$/) { + if ($key =~ /^type(\d+)-(\d+)-(\d+)$/a || $key =~ /_type$/) { $params->{$key} = BOOLEAN_TYPE_MAP->{$params->{$key}} || $params->{$key}; } @@ -348,7 +348,7 @@ sub search_bugs_request { $key =~ /^(field\d+-\d+-\d+| changed_field| (x|y|z)_axis_field)$ - /x + /ax ) { $params->{$key} = $FIELD_NEW_TO_OLD->{$params->{$key}} || $params->{$key}; @@ -376,7 +376,7 @@ sub search_bugs_request { } # Other convenience search variables used by BzAPI - my @field_ids = grep(/^f(\d+)$/, keys %$params); + my @field_ids = grep(/^f(\d+)$/a, keys %$params); my $last_field_id = @field_ids ? max @field_ids + 1 : 1; foreach my $field (qw(setters.login_name requestees.login_name)) { if (my $value = delete $params->{$field}) { diff --git a/extensions/ComponentWatching/Extension.pm b/extensions/ComponentWatching/Extension.pm index c3928b1a8d..df98c1fc90 100644 --- a/extensions/ComponentWatching/Extension.pm +++ b/extensions/ComponentWatching/Extension.pm @@ -450,7 +450,7 @@ sub _getWatches { my ($user, $watch_id) = @_; my $dbh = Bugzilla->dbh; - $watch_id = (defined $watch_id && $watch_id =~ /^(\d+)$/) ? $1 : undef; + $watch_id = (defined $watch_id && $watch_id =~ /^(\d+)$/a) ? $1 : undef; my $sth = $dbh->prepare(" SELECT id, product_id, component_id, component_prefix diff --git a/extensions/ComponentWatching/lib/WebService.pm b/extensions/ComponentWatching/lib/WebService.pm index 1da3d6aad0..ae917e328c 100644 --- a/extensions/ComponentWatching/lib/WebService.pm +++ b/extensions/ComponentWatching/lib/WebService.pm @@ -24,7 +24,7 @@ sub rest_resources { return [ qr{^/component-watching$}, {GET => {method => 'list',}, POST => {method => 'add',},}, - qr{^/component-watching/(\d+)$}, + qr{^/component-watching/(\d+)$}a, { GET => { method => 'get', diff --git a/extensions/EditComments/Extension.pm b/extensions/EditComments/Extension.pm index 8d02ef2531..c248d21878 100644 --- a/extensions/EditComments/Extension.pm +++ b/extensions/EditComments/Extension.pm @@ -248,7 +248,7 @@ sub bug_end_of_update { my $updated = 0; foreach my $param (grep(/^edit_comment_textarea_/, keys %$params)) { - my ($comment_id) = $param =~ /edit_comment_textarea_(\d+)$/; + my ($comment_id) = $param =~ /edit_comment_textarea_(\d+)$/a; next if !detaint_natural($comment_id); # The comment ID must belong to this bug. diff --git a/extensions/EditComments/lib/WebService.pm b/extensions/EditComments/lib/WebService.pm index 7a953ba481..28b626d17d 100644 --- a/extensions/EditComments/lib/WebService.pm +++ b/extensions/EditComments/lib/WebService.pm @@ -71,7 +71,7 @@ sub update_comment { my $user = Bugzilla->login(LOGIN_REQUIRED); my $comment_id - = (defined $params->{comment_id} && $params->{comment_id} =~ /^(\d+)$/) + = (defined $params->{comment_id} && $params->{comment_id} =~ /^(\d+)$/a) ? $1 : undef; @@ -163,12 +163,12 @@ sub modify_revision { unless $user->is_edit_comments_admin; my $comment_id - = (defined $params->{comment_id} && $params->{comment_id} =~ /^(\d+)$/) + = (defined $params->{comment_id} && $params->{comment_id} =~ /^(\d+)$/a) ? $1 : undef; my $change_when = (defined $params->{change_when} - && $params->{change_when} =~ /^(\d{4}-\d{2}-\d{2}\ \d{2}:\d{2}:\d{2})$/) + && $params->{change_when} =~ /^(\d{4}-\d{2}-\d{2}\ \d{2}:\d{2}:\d{2})$/a) ? $1 : undef; my $is_hidden @@ -200,7 +200,7 @@ sub modify_revision { sub rest_resources { return [ - qr{^/editcomments/comment/(\d+)$}, + qr{^/editcomments/comment/(\d+)$}a, { GET => { method => 'comments', diff --git a/extensions/Ember/lib/WebService.pm b/extensions/Ember/lib/WebService.pm index d8a3673ac2..2a435450d6 100644 --- a/extensions/Ember/lib/WebService.pm +++ b/extensions/Ember/lib/WebService.pm @@ -741,7 +741,7 @@ sub rest_resources { {GET => {method => 'create'}}, # show bug page - single bug id - qr{^/ember/show/(\d+)$}, + qr{^/ember/show/(\d+)$}a, { GET => { method => 'show', @@ -757,7 +757,7 @@ sub rest_resources { {GET => {method => 'search',},}, # get current bug attributes without field information - single bug id - qr{^/ember/bug/(\d+)$}, + qr{^/ember/bug/(\d+)$}a, { GET => { method => 'bug', @@ -769,7 +769,7 @@ sub rest_resources { # attachments - wrapper around SUPER::attachments that also includes # can_edit attribute - qr{^/ember/bug/(\d+)/attachments$}, + qr{^/ember/bug/(\d+)/attachments$}a, { GET => { method => 'get_attachments', @@ -778,7 +778,7 @@ sub rest_resources { } } }, - qr{^/ember/bug/attachments/(\d+)$}, + qr{^/ember/bug/attachments/(\d+)$}a, { GET => { method => 'get_attachments', diff --git a/extensions/Example/Extension.pm b/extensions/Example/Extension.pm index 4537df0a39..c97089ae61 100644 --- a/extensions/Example/Extension.pm +++ b/extensions/Example/Extension.pm @@ -405,7 +405,7 @@ sub email_in_before_parse { my $subject = $args->{mail}->header('Subject'); # Correctly extract the bug ID from email subjects of the form [Bug comp/NNN]. - if ($subject =~ /\[.*(\d+)\].*/) { + if ($subject =~ /\[.*(\d+)\].*/a) { $args->{fields}->{bug_id} = $1; } } diff --git a/extensions/InlineHistory/Extension.pm b/extensions/InlineHistory/Extension.pm index 9d37446882..828e3ba589 100644 --- a/extensions/InlineHistory/Extension.pm +++ b/extensions/InlineHistory/Extension.pm @@ -125,7 +125,7 @@ sub template_before_process { foreach my $what (qw(removed added)) { my @buglist = split(/[\s,]+/, $change->{$what}); foreach my $id (@buglist) { - if ($id && $id =~ /^\d+$/) { + if ($id && $id =~ /^\d+$/a) { $visible_bug_ids{$id} = 1; } } @@ -140,7 +140,7 @@ sub template_before_process { foreach my $value (split(/, /, $change->{$f})) { my ($bug_id) = substr($value, 0, length($url_base)) eq $url_base - ? $value =~ /id=(\d+)$/ + ? $value =~ /id=(\d+)$/a : undef; push @values, {url => $value, bug_id => $bug_id,}; } diff --git a/extensions/Needinfo/Extension.pm b/extensions/Needinfo/Extension.pm index 1aa00334cc..d17a9e72c0 100644 --- a/extensions/Needinfo/Extension.pm +++ b/extensions/Needinfo/Extension.pm @@ -114,7 +114,7 @@ sub bug_start_of_update { my @needinfo_overrides; foreach my $key (grep(/^needinfo_override_/, keys %$params)) { - my ($id) = $key =~ /(\d+)$/; + my ($id) = $key =~ /(\d+)$/a; # Should always be true if key exists (checkbox) but better to be sure push(@needinfo_overrides, $id) if $id && $params->{$key}; diff --git a/extensions/PhabBugz/lib/Constants.pm b/extensions/PhabBugz/lib/Constants.pm index aba2b1ee0d..6650af2650 100644 --- a/extensions/PhabBugz/lib/Constants.pm +++ b/extensions/PhabBugz/lib/Constants.pm @@ -24,7 +24,7 @@ our @EXPORT = qw( ); use constant LANDO_AUTOMATION_USER => 'lobot@bmo.tld'; -use constant PHAB_ATTACHMENT_PATTERN => qr/^phabricator-D(\d+)/; +use constant PHAB_ATTACHMENT_PATTERN => qr/^phabricator-D(\d+)/a; use constant PHAB_AUTOMATION_USER => 'phab-bot@bmo.tld'; use constant PHAB_CONTENT_TYPE => 'text/x-phabricator-request'; use constant PHAB_FEED_POLL_SECONDS => $ENV{PHAB_FEED_POLL} // 5; diff --git a/extensions/PhabBugz/lib/Feed.pm b/extensions/PhabBugz/lib/Feed.pm index c125908bcd..b5bcd58378 100644 --- a/extensions/PhabBugz/lib/Feed.pm +++ b/extensions/PhabBugz/lib/Feed.pm @@ -354,7 +354,7 @@ sub group_query { sub process_revision_change { state $check = compile($Invocant, Revision, LinkedPhabUser, Str); my ($self, $revision, $changer, $story_text) = $check->(@_); - my $is_new = $story_text =~ /\s+created\s+D\d+/; + my $is_new = $story_text =~ /\s+created\s+D\d+/a; # NO BUG ID if (!$revision->bug_id) { diff --git a/extensions/PhabBugz/lib/WebService.pm b/extensions/PhabBugz/lib/WebService.pm index 141bc8849c..c192ce665a 100644 --- a/extensions/PhabBugz/lib/WebService.pm +++ b/extensions/PhabBugz/lib/WebService.pm @@ -208,7 +208,7 @@ sub bug_revisions { sub rest_resources { return [ # Bug permission checks - qr{^/phabbugz/check_bug/(\d+)/(\d+)$}, + qr{^/phabbugz/check_bug/(\d+)/(\d+)$}a, { GET => { method => 'check_user_permission_for_bug', @@ -217,7 +217,7 @@ sub rest_resources { } } }, - qr{^/phabbugz/check_enter_bug/([^/]+)/(\d+)$}, + qr{^/phabbugz/check_enter_bug/([^/]+)/(\d+)$}a, { GET => { method => 'check_user_enter_bug_permission', @@ -226,7 +226,7 @@ sub rest_resources { }, }, }, - qr{^/phabbugz/bug_revisions/(\d+)$}, + qr{^/phabbugz/bug_revisions/(\d+)$}a, { GET => { method => 'bug_revisions', diff --git a/extensions/REMO/Extension.pm b/extensions/REMO/Extension.pm index 98502861c3..552163750e 100644 --- a/extensions/REMO/Extension.pm +++ b/extensions/REMO/Extension.pm @@ -283,7 +283,7 @@ sub post_bug_after_creation { my @columns_raw = sort { $CSV_COLUMNS{$a}{pos} <=> $CSV_COLUMNS{$b}{pos} } keys %CSV_COLUMNS; my @data = map { _expand_value($CSV_COLUMNS{$_}{value}) } @columns_raw; - my @columns = map { s/^(Item|Email) \d+$/$1/g; $_ } @columns_raw; + my @columns = map { s/^(Item|Email) \d+$/$1/ag; $_ } @columns_raw; my $csv = _csv_encode(\@columns, \@data); push @attachments, diff --git a/extensions/RequestNagger/Extension.pm b/extensions/RequestNagger/Extension.pm index 5d9d0894b3..5a5b1ecc0e 100644 --- a/extensions/RequestNagger/Extension.pm +++ b/extensions/RequestNagger/Extension.pm @@ -120,7 +120,7 @@ sub page_before_template { my $date = DateTime->now()->truncate(to => 'day'); my $defer_until; if ( $input->{'defer-until'} - && $input->{'defer-until'} =~ /^(\d\d\d\d)-(\d\d)-(\d\d)$/) + && $input->{'defer-until'} =~ /^(\d\d\d\d)-(\d\d)-(\d\d)$/a) { $defer_until = DateTime->new(year => $1, month => $2, day => $3); if ($defer_until > $date->clone->add(days => 7)) { diff --git a/extensions/Review/Extension.pm b/extensions/Review/Extension.pm index d978a4c426..92c0a873b0 100644 --- a/extensions/Review/Extension.pm +++ b/extensions/Review/Extension.pm @@ -558,7 +558,7 @@ sub _check_review_flag { my $cgi = Bugzilla->cgi; # extract the set flag-types - my @flagtype_ids = map { /^flag_type-(\d+)$/ ? $1 : () } $cgi->param(); + my @flagtype_ids = map { /^flag_type-(\d+)$/a ? $1 : () } $cgi->param(); @flagtype_ids = grep { $cgi->param("flag_type-$_") eq '?' } @flagtype_ids; return unless scalar(@flagtype_ids); diff --git a/extensions/Review/lib/WebService.pm b/extensions/Review/lib/WebService.pm index ff07b243d2..9afa47147c 100644 --- a/extensions/Review/lib/WebService.pm +++ b/extensions/Review/lib/WebService.pm @@ -145,7 +145,7 @@ sub flag_activity { $limit = $max_results; } - if ($after && $after =~ /^(\d{4}-\d{1,2}-\d{1,2})$/) { + if ($after && $after =~ /^(\d{4}-\d{1,2}-\d{1,2})$/a) { $after = $1; } else { @@ -154,7 +154,7 @@ sub flag_activity { $after = $now->ymd('-'); } - if ($before && $before =~ /^(\d{4}-\d{1,2}-\d{1,2})$/) { + if ($before && $before =~ /^(\d{4}-\d{1,2}-\d{1,2})$/a) { $before = $1; } else { @@ -194,7 +194,7 @@ sub _can_see_attachment { sub rest_resources { return [ # bug-id - qr{^/review/suggestions/(\d+)$}, + qr{^/review/suggestions/(\d+)$}a, { GET => { method => 'suggestions', @@ -231,7 +231,7 @@ sub rest_resources { {GET => {method => 'suggestions',},}, # flag activity by flag id - qr{^/review/flag_activity/(\d+)$}, + qr{^/review/flag_activity/(\d+)$}a, { GET => { method => 'flag_activity', diff --git a/extensions/SecureMail/Extension.pm b/extensions/SecureMail/Extension.pm index b771a550a6..9c36f4bbc7 100644 --- a/extensions/SecureMail/Extension.pm +++ b/extensions/SecureMail/Extension.pm @@ -310,7 +310,7 @@ sub mailer_before_send { # This is also a bit of a hack, but there's no header with the # bug ID in. So we take the first number in the subject. - my ($bug_id) = ($email->header('Subject') =~ /\[\D+(\d+)\]/); + my ($bug_id) = ($email->header('Subject') =~ /\[\D+(\d+)\]/a); my $bug = new Bugzilla::Bug($bug_id); if (!_should_secure_bug($bug)) { $make_secure = SECURE_NONE; @@ -336,7 +336,7 @@ sub mailer_before_send { $body = $part->body if $content_type && $content_type =~ /^text\/plain/; }); } - while ($body =~ /[\r\n]--- Comment #(\d+)/g) { + while ($body =~ /[\r\n]--- Comment #(\d+)/ag) { my $comment_number = $1; if ($comment_number && $comment_is_private->[$comment_number]) { $make_secure = SECURE_BODY; @@ -440,7 +440,7 @@ sub _should_secure_whine { my $content_type = $part->content_type; return if !$content_type || $content_type !~ /^text\/plain/; my $body = $part->body; - my @bugids = $body =~ /Bug (\d+):/g; + my @bugids = $body =~ /Bug (\d+):/ag; foreach my $id (@bugids) { $id = trim($id); next if !$id; @@ -461,7 +461,7 @@ sub _make_secure { $email->header_set('X-Bugzilla-Secure-Email', 'Yes'); my $subject = $email->header('Subject'); - my ($bug_id) = $subject =~ /\[\D+(\d+)\]/; + my ($bug_id) = $subject =~ /\[\D+(\d+)\]/a; my $key_type = 0; if ($key && $key =~ /PUBLIC KEY/) { @@ -686,7 +686,7 @@ sub _filter_bug_links { my $updated = 0; foreach my $link (@links) { my $href = $link->attr('href'); - my ($bug_id) = $href =~ /\Qshow_bug.cgi?id=\E(\d+)/; + my ($bug_id) = $href =~ /\Qshow_bug.cgi?id=\E(\d+)/a; my $bug = new Bugzilla::Bug($bug_id); if ($bug && _should_secure_bug($bug)) { $link->attr('title', '(secure bug)'); diff --git a/extensions/Splinter/Extension.pm b/extensions/Splinter/Extension.pm index 1edb7741c3..dff1eda6c7 100644 --- a/extensions/Splinter/Extension.pm +++ b/extensions/Splinter/Extension.pm @@ -114,7 +114,7 @@ sub object_end_of_create { if ($class eq 'Bugzilla::Comment') { my $comment = $args->{object}; - if ($comment->body =~ /^Review of attachment (\d+)\s*:\n-{65}\n\n/s) { + if ($comment->body =~ /^Review of attachment (\d+)\s*:\n-{65}\n\n/as) { $comment->set_is_markdown(0); $comment->update; } @@ -139,13 +139,13 @@ sub bug_format_comment { ~(push(@$regexes, { match => qr/__REVIEW__$2/, replace => get_review_link("$2", "[review]") })) && (attachment_id_is_patch($2) ? "$1 __REVIEW__$2" : $1) - ~egmx; + ~egmxa; # And linkify "Review of attachment", this is less of a workaround since # there is no issue with overlap; note that there is an assumption that # there is only one match in the text we are linkifying, since they all # get the same link. - my $REVIEW_RE = qr/Review\s+of\s+attachment\s+(\d+)\s*:/; + my $REVIEW_RE = qr/Review\s+of\s+attachment\s+(\d+)\s*:/a; if ($$text =~ $REVIEW_RE) { my $attach_id = $1; diff --git a/extensions/Splinter/lib/Util.pm b/extensions/Splinter/lib/Util.pm index 735e693aa8..d8c202495a 100644 --- a/extensions/Splinter/lib/Util.pm +++ b/extensions/Splinter/lib/Util.pm @@ -158,7 +158,7 @@ sub add_review_links_to_email { my $new_body = 0; my $bug; - if ($email->header('Subject') =~ /^\[Bug\s+(\d+)\]/ + if ($email->header('Subject') =~ /^\[Bug\s+(\d+)\]/a && Bugzilla->user->can_see_bug($1)) { $bug = Bugzilla::Bug->new({id => $1, cache => 1}); @@ -166,18 +166,18 @@ sub add_review_links_to_email { return unless defined $bug; - if ($body =~ /Review\s+of\s+attachment\s+\d+\s*:/) { + if ($body =~ /Review\s+of\s+attachment\s+\d+\s*:/a) { $body =~ s~(Review\s+of\s+attachment\s+(\d+)\s*:) ~"$1\015\012 --> (" . get_review_url($bug, $2, 1) . ")" - ~egx; + ~egxa; $new_body = 1; } - if ($body =~ /Created attachment \d+\015\012 --> /) { + if ($body =~ /Created attachment \d+\015\012 --> /a) { $body =~ s~(Created\ attachment\ (\d+)\015\012) \ -->\ \(([^\015\012]*)\)[^\015\012]* ~munge_create_attachment($bug, $1, $2, $3) - ~egx; + ~egxa; $new_body = 1; } diff --git a/extensions/TagNewUsers/Extension.pm b/extensions/TagNewUsers/Extension.pm index 43909646aa..5e4f0dcd35 100644 --- a/extensions/TagNewUsers/Extension.pm +++ b/extensions/TagNewUsers/Extension.pm @@ -232,7 +232,7 @@ sub mailer_before_send { my ($self, $args) = @_; my $email = $args->{email}; - my ($bug_id) = ($email->header('Subject') =~ /^[^\d]+(\d+)/); + my ($bug_id) = ($email->header('Subject') =~ /^[^\d]+(\d+)/a); my $changer_login = $email->header('X-Bugzilla-Who'); my $changed_fields = $email->header('X-Bugzilla-Changed-Fields'); diff --git a/extensions/TrackingFlags/Extension.pm b/extensions/TrackingFlags/Extension.pm index 94d0ebdaa4..00bf3e9b5d 100644 --- a/extensions/TrackingFlags/Extension.pm +++ b/extensions/TrackingFlags/Extension.pm @@ -179,8 +179,8 @@ sub _get_highest_status_firefox { my @status_flags = sort { $b <=> $a } - map { $_->name =~ /(\d+)$/; $1 } - grep { $_->is_active && $_->name =~ /^cf_status_firefox\d/ } @$flags; + map { $_->name =~ /(\d+)$/a; $1 } + grep { $_->is_active && $_->name =~ /^cf_status_firefox\d/a } @$flags; return @status_flags ? $status_flags[0] : undef; } @@ -678,7 +678,7 @@ sub quicksearch_map { my $map = $args->{'map'}; foreach my $name (keys %$map) { - if ($name =~ /^cf_(blocking|tracking|status)_([a-z]+)?(\d+)?$/) { + if ($name =~ /^cf_(blocking|tracking|status)_([a-z]+)?(\d+)?$/a) { my $type = $1; my $product = $2; my $version = $3; diff --git a/extensions/TrackingFlags/lib/Admin.pm b/extensions/TrackingFlags/lib/Admin.pm index 7353e2cc64..0424d5123c 100644 --- a/extensions/TrackingFlags/lib/Admin.pm +++ b/extensions/TrackingFlags/lib/Admin.pm @@ -123,10 +123,10 @@ sub admin_edit { {item => 'flag', id => $vars->{copy_from}}); # increment the number at the end of the name and description - if ($flag->name =~ /^(\D+)(\d+)$/) { + if ($flag->name =~ /^(\D+)(\d+)$/a) { $flag->set_name("$1" . ($2 + 1)); } - if ($flag->description =~ /^(\D+)([\d\.]+)$/) { + if ($flag->description =~ /^(\D+)([\d\.]+)$/a) { my $description = $1; my $version = $2; if ($version =~ /\./) { diff --git a/extensions/Voting/Extension.pm b/extensions/Voting/Extension.pm index 8ef9febd34..f844f6282e 100644 --- a/extensions/Voting/Extension.pm +++ b/extensions/Voting/Extension.pm @@ -525,7 +525,7 @@ sub _update_votes { # are submitted in form fields in which the field names are the bug # IDs and the field values are the number of votes. - my @buglist = grep {/^\d+$/} keys %$input; + my @buglist = grep {/^\d+$/a} keys %$input; my (%bugs, %votes); # If no bugs are in the buglist, let's make sure the user gets notified diff --git a/importxml.pl b/importxml.pl index 9a2d51ca53..b124663853 100755 --- a/importxml.pl +++ b/importxml.pl @@ -513,13 +513,13 @@ sub process_bug { # to the wrong attachment. Since the new attachment ID is unknown yet # let's strip it out for now. We will make a comment with the right ID # later - $data =~ s/Created an attachment \(id=\d+\)/Created an attachment/g; + $data =~ s/Created an attachment \(id=\d+\)/Created an attachment/ag; # Same goes for bug #'s Since we don't know if the referenced bug # is also being moved, lets make sure they know it means a different - # Bugzilla. + # bugzilla. my $url = $urlbase . "show_bug.cgi?id="; - $data =~ s/([Bb]ugs?\s*\#?\s*(\d+))/$url$2/g; + $data =~ s/([Bb]ugs?\s*\#?\s*(\d+))/$url$2/ag; # Keep the original commenter if possible, else we will fall back # to the exporter account. diff --git a/process_bug.cgi b/process_bug.cgi index a2e4346d8f..530de76cb8 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -341,9 +341,10 @@ if (defined $cgi->param('id')) { my %is_private; foreach my $field (grep(/^defined_isprivate/, $cgi->param())) { - $field =~ /(\d+)$/; - my $comment_id = $1; - $is_private{$comment_id} = $cgi->param("isprivate_$comment_id"); + if ($field =~ /(\d+)$/a) { + my $comment_id = $1; + $is_private{$comment_id} = $cgi->param("isprivate_$comment_id"); + } } $set_all_fields{comment_is_private} = \%is_private; diff --git a/qa/extensions/QA/lib/Util.pm b/qa/extensions/QA/lib/Util.pm index 9b90263432..7f443eb708 100644 --- a/qa/extensions/QA/lib/Util.pm +++ b/qa/extensions/QA/lib/Util.pm @@ -19,7 +19,7 @@ sub parse_output { $vars->{error} = ($output =~ /software error/i) ? 1 : 0; $vars->{output} = $output; - $vars->{bug_id} ||= ($output =~ /Created bug (\d+)/i) ? $1 : undef; + $vars->{bug_id} ||= ($output =~ /Created bug (\d+)/ai) ? $1 : undef; } 1; diff --git a/qa/t/archived/test_email_preferences.t b/qa/t/archived/test_email_preferences.t index a9f7006e3d..30e67189f1 100644 --- a/qa/t/archived/test_email_preferences.t +++ b/qa/t/archived/test_email_preferences.t @@ -463,7 +463,7 @@ sub set_flag { if (defined $login) { my $flag_name = $sel->get_attribute("//table[\@id='flags']//input[\@value='$login']\@name"); - $flag_name =~ /^requestee-(\d+)$/; + $flag_name =~ /^requestee-(\d+)$/a; $flag_id = $1; } diff --git a/qa/t/lib/QA/RPC.pm b/qa/t/lib/QA/RPC.pm index 92fc755dea..169c42f60d 100644 --- a/qa/t/lib/QA/RPC.pm +++ b/qa/t/lib/QA/RPC.pm @@ -287,7 +287,7 @@ sub bz_test_bug { like( $bug->{$field}, - qr/^\Q${creation_day}\ET\d\d:\d\d:\d\d/, + qr/^\Q${creation_day}\ET\d\d:\d\d:\d\d/a, $self->TYPE . ": $field has the right format" ); } diff --git a/qa/t/lib/QA/RPC/JSONRPC.pm b/qa/t/lib/QA/RPC/JSONRPC.pm index 3a72ada9d5..c56f7b6703 100644 --- a/qa/t/lib/QA/RPC/JSONRPC.pm +++ b/qa/t/lib/QA/RPC/JSONRPC.pm @@ -26,7 +26,7 @@ BEGIN { use URI::Escape; -use constant DATETIME_REGEX => qr/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ$/; +use constant DATETIME_REGEX => qr/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ$/a; sub TYPE { my ($self) = @_; diff --git a/qa/t/lib/QA/RPC/XMLRPC.pm b/qa/t/lib/QA/RPC/XMLRPC.pm index 6e63852eb6..b82db8fc03 100644 --- a/qa/t/lib/QA/RPC/XMLRPC.pm +++ b/qa/t/lib/QA/RPC/XMLRPC.pm @@ -12,7 +12,7 @@ use strict; use base qw(QA::RPC XMLRPC::Lite); use constant TYPE => 'XML-RPC'; -use constant DATETIME_REGEX => qr/^\d{8}T\d\d:\d\d:\d\d$/; +use constant DATETIME_REGEX => qr/^\d{8}T\d\d:\d\d:\d\d$/a; 1; diff --git a/qa/t/test_bmo_autolinkification.t b/qa/t/test_bmo_autolinkification.t index 29b6f3862d..674e0b32c3 100644 --- a/qa/t/test_bmo_autolinkification.t +++ b/qa/t/test_bmo_autolinkification.t @@ -22,13 +22,13 @@ $sel->type_ok("short_desc", $bug_summary); $sel->type_ok("comment", "linkification test"); $sel->click_ok("commit"); $sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/\d+ \S $bug_summary/, "Bug created"); +$sel->title_like(qr/\d+ \S $bug_summary/a, "Bug created"); my $bug_id = $sel->get_value("//input[\@name='id' and \@type='hidden']"); $sel->type_ok("comment", "bp-63f096f7-253b-4ee2-ae3d-8bb782090824"); $sel->click_ok("bottom-save-btn"); $sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/\d+ \S $bug_summary/, "crash report added"); +$sel->title_like(qr/\d+ \S $bug_summary/a, "crash report added"); go_to_bug($sel, $bug_id); attribute_is($sel, 'bp-63f096f7-253b-4ee2-ae3d-8bb782090824', 'https://crash-stats.mozilla.org/report/index/63f096f7-253b-4ee2-ae3d-8bb782090824' @@ -37,7 +37,7 @@ attribute_is($sel, 'bp-63f096f7-253b-4ee2-ae3d-8bb782090824', $sel->type_ok("comment", "CVE-2010-2884"); $sel->click_ok("bottom-save-btn"); $sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/\d+ \S $bug_summary/, "cve added"); +$sel->title_like(qr/\d+ \S $bug_summary/a, "cve added"); go_to_bug($sel, $bug_id); attribute_is($sel, 'CVE-2010-2884', 'https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2010-2884'); @@ -45,7 +45,7 @@ attribute_is($sel, 'CVE-2010-2884', $sel->type_ok("comment", "r12345"); $sel->click_ok("bottom-save-btn"); $sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/\d+ \S $bug_summary/, "svn revision added"); +$sel->title_like(qr/\d+ \S $bug_summary/a, "svn revision added"); go_to_bug($sel, $bug_id); attribute_is($sel, 'r12345', 'https://viewvc.svn.mozilla.org/vc?view=rev&revision=12345'); diff --git a/qa/t/test_bug_edit.t b/qa/t/test_bug_edit.t index 19d0390414..2711a8f4b9 100644 --- a/qa/t/test_bug_edit.t +++ b/qa/t/test_bug_edit.t @@ -43,7 +43,7 @@ check_page_load($sel, q{http://HOSTNAME/editgroups.cgi?action=changeform&group=25}); $sel->title_is("Change Group: Master"); my $group_url = $sel->get_location(); -$group_url =~ /group=(\d+)$/; +$group_url =~ /group=(\d+)$/a; my $master_gid = $1; clear_canedit_on_testproduct($sel, $master_gid); diff --git a/qa/t/test_default_groups.t b/qa/t/test_default_groups.t index 8713ee577c..1299ff15b9 100644 --- a/qa/t/test_default_groups.t +++ b/qa/t/test_default_groups.t @@ -37,7 +37,7 @@ $sel->click_ok("link=ready_to_die"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Change Group: ready_to_die"); my $group_url = $sel->get_location(); -$group_url =~ /group=(\d+)/; +$group_url =~ /group=(\d+)/a; my $group1_id = $1; $sel->value_is("desc", "Access to bugs in the ready_to_die product"); my @groups = $sel->get_select_options("members_remove"); @@ -99,7 +99,7 @@ $sel->click_ok("link=ready_to_die_"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Change Group: ready_to_die_"); $group_url = $sel->get_location(); -$group_url =~ /group=(\d+)/; +$group_url =~ /group=(\d+)/a; my $group2_id = $1; $sel->value_is("desc", "Access to bugs in the ready_to_die product"); @groups = $sel->get_select_options("members_remove"); diff --git a/qa/t/test_flags.t b/qa/t/test_flags.t index 67ea251bc7..7c75775987 100644 --- a/qa/t/test_flags.t +++ b/qa/t/test_flags.t @@ -76,7 +76,7 @@ $sel->title_is("Flag Type 'SeleniumBugFlag1Test' Created"); $sel->is_text_present_ok( "The flag type SeleniumBugFlag1Test has been created."); my $flagtype_url = $sel->get_attribute('link=SeleniumBugFlag1Test@href'); -$flagtype_url =~ /id=(\d+)$/; +$flagtype_url =~ /id=(\d+)$/a; my $flagtype1_id = $1; # Clone the flag type, but set the request group to 'editbugs' and the sortkey to 950. @@ -117,7 +117,7 @@ $sel->title_is("Flag Type 'SeleniumBugFlag2Test' Created"); $sel->is_text_present_ok( "The flag type SeleniumBugFlag2Test has been created."); $flagtype_url = $sel->get_attribute('link=SeleniumBugFlag2Test@href'); -$flagtype_url =~ /id=(\d+)$/; +$flagtype_url =~ /id=(\d+)$/a; my $flagtype2_id = $1; # Clone the first flag type again, but with different attributes. @@ -142,7 +142,7 @@ $sel->title_is("Flag Type 'SeleniumBugFlag3Test' Created"); $sel->is_text_present_ok( "The flag type SeleniumBugFlag3Test has been created."); $flagtype_url = $sel->get_attribute('link=SeleniumBugFlag3Test@href'); -$flagtype_url =~ /id=(\d+)$/; +$flagtype_url =~ /id=(\d+)$/a; my $flagtype3_id = $1; # We now create a flag type for attachments. @@ -177,7 +177,7 @@ $sel->title_is("Flag Type 'SeleniumAttachmentFlag1Test' Created"); $sel->is_text_present_ok( "The flag type SeleniumAttachmentFlag1Test has been created."); $flagtype_url = $sel->get_attribute('link=SeleniumAttachmentFlag1Test@href'); -$flagtype_url =~ /id=(\d+)$/; +$flagtype_url =~ /id=(\d+)$/a; my $aflagtype1_id = $1; # Clone the flag type. @@ -206,7 +206,7 @@ $sel->title_is("Flag Type 'SeleniumAttachmentFlag2Test' Created"); $sel->is_text_present_ok( "The flag type SeleniumAttachmentFlag2Test has been created."); $flagtype_url = $sel->get_attribute('link=SeleniumAttachmentFlag2Test@href'); -$flagtype_url =~ /id=(\d+)$/; +$flagtype_url =~ /id=(\d+)$/a; my $aflagtype2_id = $1; # Clone the flag type again, and set it as inactive. @@ -226,7 +226,7 @@ $sel->title_is("Flag Type 'SeleniumAttachmentFlag3Test' Created"); $sel->is_text_present_ok( "The flag type SeleniumAttachmentFlag3Test has been created."); $flagtype_url = $sel->get_attribute('link=SeleniumAttachmentFlag3Test@href'); -$flagtype_url =~ /id=(\d+)$/; +$flagtype_url =~ /id=(\d+)$/a; my $aflagtype3_id = $1; # All flag types have been created. Now "real" tests can start. @@ -375,12 +375,12 @@ $sel->type_ok("requestee_type-$aflagtype2_id", $config->{admin_user_login}); $sel->type_ok("comment", "patch for testing purposes only"); $sel->click_ok("create"); $sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->is_text_present_ok('regexp:Attachment #\d+ to bug \d+ created'); +$sel->is_text_present_ok('regexp:Attachment #(?a:\\d+) to bug (?a:\\d+) created'); # Store the flag ID. my $alink = $sel->get_attribute('//a[@title="patch, v1"]@href'); -$alink =~ /id=(\d+)/; +$alink =~ /id=(\d+)/a; my $attachment1_id = $1; # Now create another attachment, and set requestees. @@ -405,9 +405,9 @@ $sel->type_ok("requestee_type-$aflagtype2_id", $sel->type_ok("comment", "second patch, with requestee"); $sel->click_ok("create"); $sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->is_text_present_ok('regexp:Attachment #\d+ to bug \d+ created'); +$sel->is_text_present_ok('regexp:Attachment #(?a:\\d+) to bug (?a:\\d+) created'); $alink = $sel->get_attribute('//a[@title="patch, v2"]@href'); -$alink =~ /id=(\d+)/; +$alink =~ /id=(\d+)/a; my $attachment2_id = $1; # Create a third attachment, but we now set the MIME type manually. @@ -424,9 +424,9 @@ $sel->select_ok("flag_type-$aflagtype1_id", "label=+"); $sel->type_ok("comment", "one +, the other one blank"); $sel->click_ok("create"); $sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->is_text_present_ok('regexp:Attachment #\d+ to bug \d+ created'); +$sel->is_text_present_ok('regexp:Attachment #(?a:\\d+) to bug (?a:\\d+) created'); $alink = $sel->get_attribute('//a[@title="patch, v3"]@href'); -$alink =~ /id=(\d+)/; +$alink =~ /id=(\d+)/a; my $attachment3_id = $1; # Display the bug and check flags are correctly set. @@ -513,7 +513,7 @@ $sel->select_ok("flag_type-$aflagtype2_id", "label=+"); $sel->type_ok("comment", "granting again"); $sel->click_ok("create"); $sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->is_text_present_ok('regexp:Attachment #\d+ to bug \d+ created'); +$sel->is_text_present_ok('regexp:Attachment #(?a:\\d+) to bug (?a:\\d+) created'); go_to_bug($sel, $bug1_id, 1); $sel->is_element_present_ok( qq{//div[\@class="attach-flag"]/div/span[text()="$config->{unprivileged_user_nick}"]/../..//a[normalize-space(text())="SeleniumAttachmentFlag2Test+"]} diff --git a/qa/t/test_flags2.t b/qa/t/test_flags2.t index d422327ac3..ea8f6056ed 100644 --- a/qa/t/test_flags2.t +++ b/qa/t/test_flags2.t @@ -71,7 +71,7 @@ $sel->is_text_present_ok("The flag type selenium has been created."); $sel->click_ok("link=selenium"); $sel->wait_for_page_to_load_ok(WAIT_TIME); my $flag_url = $sel->get_location(); -$flag_url =~ /id=(\d+)/; +$flag_url =~ /id=(\d+)/a; my $flagtype1_id = $1; # Now create a flag type for attachments in 'Another Product'. @@ -108,7 +108,7 @@ $sel->is_text_present_ok("The flag type selenium_review has been created."); $sel->click_ok("link=selenium_review"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $flag_url = $sel->get_location(); -$flag_url =~ /id=(\d+)/; +$flag_url =~ /id=(\d+)/a; my $aflagtype1_id = $1; # Create a 2nd flag type for attachments, with the same name @@ -139,7 +139,7 @@ $sel->title_is("Flag Type 'selenium_review' Created"); $sel->click_ok("link=selenium_review"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $flag_url = $sel->get_location(); -$flag_url =~ /id=(\d+)/; +$flag_url =~ /id=(\d+)/a; my $aflagtype2_id = $1; # We are done with the admin tasks. Now play with flags in bugs. @@ -285,7 +285,7 @@ $sel->title_is("Flag Type 'selenium' Created"); $sel->click_ok("link=selenium"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $flag_url = $sel->get_location(); -$flag_url =~ /id=(\d+)/; +$flag_url =~ /id=(\d+)/a; my $flagtype2_id = $1; # Now move the bug from c1 into c2. The bug flag should survive. diff --git a/qa/t/test_private_attachments.t b/qa/t/test_private_attachments.t index a3ad5f01ca..9b54aa2d61 100644 --- a/qa/t/test_private_attachments.t +++ b/qa/t/test_private_attachments.t @@ -67,12 +67,12 @@ $sel->type_ok("comment", "this patch is public. Everyone can see it."); $sel->value_is("isprivate", "off"); $sel->click_ok("create"); $sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->is_text_present_ok('regexp:Attachment #\d+ to bug \d+ created'); +$sel->is_text_present_ok('regexp:Attachment #(?a:\\d+) to bug (?a:\\d+) created'); # We need to store the attachment ID. my $alink = $sel->get_attribute('//a[@title="public attachment, v2"]@href'); -$alink =~ /id=(\d+)/; +$alink =~ /id=(\d+)/a; my $attachment1_id = $1; # Be sure to redisplay the same bug, and make sure the new attachment is visible. @@ -133,10 +133,10 @@ $sel->type_ok('//input[@name="description"]', $sel->type_ok("comment", "This is my patch!"); $sel->click_ok("create"); $sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->is_text_present_ok('regexp:Attachment #\d+ to bug \d+ created'); +$sel->is_text_present_ok('regexp:Attachment #(?a:\\d+) to bug (?a:\\d+) created'); $alink = $sel->get_attribute( '//a[@title="My patch, which I should see, always"]@href'); -$alink =~ /id=(\d+)/; +$alink =~ /id=(\d+)/a; my $attachment2_id = $1; go_to_bug($sel, $bug1_id); $sel->is_text_present_ok("My patch, which I should see, always"); diff --git a/qa/t/test_security.t b/qa/t/test_security.t index dd1d1bef02..38f21ce6de 100644 --- a/qa/t/test_security.t +++ b/qa/t/test_security.t @@ -165,7 +165,7 @@ set_parameters($sel, go_to_bug($sel, $bug1_id); $sel->click_ok("link=Details"); $sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/Attachment \d+ Details for Bug $bug1_id/); +$sel->title_like(qr/Attachment \d+ Details for Bug $bug1_id/a); $sel->is_text_present_ok( "The attachment is not viewable in your browser due to security restrictions"); $sel->click_ok("link=View"); @@ -173,7 +173,7 @@ $sel->click_ok("link=View"); # Wait 1 second to give the browser a chance to display the attachment. # Do not use wait_for_page_to_load_ok() as the File Saver will never go away. sleep(1); -$sel->title_like(qr/Attachment \d+ Details for Bug $bug1_id/); +$sel->title_like(qr/Attachment \d+ Details for Bug $bug1_id/a); ok(!$sel->is_text_present('@@'), "Patch not displayed"); # Enable viewing attachments. diff --git a/qa/t/test_shared_searches.t b/qa/t/test_shared_searches.t index 6e5b1de8e4..8c96b6ee39 100644 --- a/qa/t/test_shared_searches.t +++ b/qa/t/test_shared_searches.t @@ -55,7 +55,7 @@ $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("User Preferences"); my $ssname = $sel->get_attribute( '//input[@type="checkbox" and @alt="Shared Selenium buglist"]@name'); -$ssname =~ /(?:link_in_footer_(\d+))/; +$ssname =~ /(?:link_in_footer_(\d+))/a; my $saved_search1_id = $1; $sel->is_checked_ok("link_in_footer_$saved_search1_id"); @@ -139,7 +139,7 @@ $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("User Preferences"); $ssname = $sel->get_attribute('//input[@type="checkbox" and @alt="helpwanted"]@name'); -$ssname =~ /(?:link_in_footer_(\d+))/; +$ssname =~ /(?:link_in_footer_(\d+))/a; my $saved_search2_id = $1; # Our own saved searches are displayed in the Search Bar by default. diff --git a/qa/t/test_time_summary.t b/qa/t/test_time_summary.t index bb6b261a22..bb7bc2a655 100644 --- a/qa/t/test_time_summary.t +++ b/qa/t/test_time_summary.t @@ -68,15 +68,15 @@ $sel->is_text_present_ok("found"); $sel->click_ok("timesummary"); $sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/^Time Summary \(\d+ bugs selected\)/); +$sel->title_like(qr/^Time Summary \(\d+ bugs selected\)/a); $sel->check_ok("monthly"); $sel->check_ok("detailed"); $sel->type_ok("start_date", "2009-01-01"); $sel->type_ok("end_date", "2009-04-30"); $sel->click_ok("summarize"); $sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/^Time Summary \(\d+ bugs selected\)/); -$sel->is_text_present_ok('regexp:Total of \d+\.\d+ hours worked'); +$sel->title_like(qr/^Time Summary \(\d+ bugs selected\)/a); +$sel->is_text_present_ok('regexp:Total of (?a:\\d+)\.(?a:\\d+) hours worked'); $sel->is_text_present_ok("2009-01-01 to 2009-01-31"); $sel->is_text_present_ok("2009-02-01 to 2009-02-28"); $sel->is_text_present_ok("2009-04-01 to 2009-04-30"); diff --git a/qa/t/test_user_groups.t b/qa/t/test_user_groups.t index c281b1e5d0..ba6e64eeb3 100644 --- a/qa/t/test_user_groups.t +++ b/qa/t/test_user_groups.t @@ -34,7 +34,7 @@ $sel->click_ok("link=Master"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Change Group: Master"); my $group_url = $sel->get_location(); -$group_url =~ /group=(\d+)$/; +$group_url =~ /group=(\d+)$/a; my $master_gid = $1; go_to_admin($sel); diff --git a/qa/t/webservice_bug_attachments.t b/qa/t/webservice_bug_attachments.t index cd2e6bfa4a..149b391ca2 100644 --- a/qa/t/webservice_bug_attachments.t +++ b/qa/t/webservice_bug_attachments.t @@ -146,8 +146,8 @@ sub post_success { cmp_ok($attachment->{creation_time}, '=~', $rpc->DATETIME_REGEX, "creation_time is in the right format"); is($attachment->{is_obsolete}, 0, 'is_obsolete is 0'); - cmp_ok($attachment->{bug_id}, '=~', qr/^\d+$/, "bug_id is an integer"); - cmp_ok($attachment->{id}, '=~', qr/^\d+$/, "id is an integer"); + cmp_ok($attachment->{bug_id}, '=~', qr/^\d+$/a, "bug_id is an integer"); + cmp_ok($attachment->{id}, '=~', qr/^\d+$/a, "id is an integer"); is($attachment->{content_type}, 'application/x-perl', "content_type is correct"); cmp_ok($attachment->{file_name}, diff --git a/qa/t/webservice_bug_comments.t b/qa/t/webservice_bug_comments.t index f3f834f851..5e9d0fa06a 100644 --- a/qa/t/webservice_bug_comments.t +++ b/qa/t/webservice_bug_comments.t @@ -56,7 +56,7 @@ sub test_comments { } like( $comment->{time}, - qr/^\Q${creation_day}\ET\d\d:\d\d:\d\d/, + qr/^\Q${creation_day}\ET\d\d:\d\d:\d\d/a, "comment time has the right format" ); } diff --git a/qa/t/webservice_bug_fields.t b/qa/t/webservice_bug_fields.t index ca52f738d7..137bde2878 100644 --- a/qa/t/webservice_bug_fields.t +++ b/qa/t/webservice_bug_fields.t @@ -142,7 +142,7 @@ foreach my $rpc (@clients) { # The sortkey for milestones can be negative. cmp_ok($first_value->{sortkey}, - '=~', qr/^-?\d+$/, "The first value has a numeric sortkey"); + '=~', qr/^-?\d+$/a, "The first value has a numeric sortkey"); ok(defined $first_value->{visibility_values}, "$field has visibility_values defined on its first value") diff --git a/query.cgi b/query.cgi index e121b4f821..056a1697a0 100755 --- a/query.cgi +++ b/query.cgi @@ -75,7 +75,7 @@ sub PrefillForm { # search or from an old link on the web somewhere) then convert them # to the new "custom search" format so that the form is populated # properly. - my $any_boolean_charts = grep {/^field-?\d+/} $buf->param(); + my $any_boolean_charts = grep {/^field-?\d+/a} $buf->param(); if ($any_boolean_charts) { my $search = new Bugzilla::Search(params => scalar $buf->Vars); $search->boolean_charts_to_custom_search($buf); @@ -92,7 +92,7 @@ sub PrefillForm { # If the name is a single letter followed by numbers, it's part # of Custom Search. We store these as an array of hashes. - if ($name =~ /^([[:lower:]])(\d+)$/) { + if ($name =~ /^([[:lower:]])(\d+)$/a) { $default{'custom_search'}->[$2]->{$1} = $values[0]; } @@ -105,7 +105,7 @@ sub PrefillForm { # If the name ends in a number (which it does for the fields which # are part of the email searching), we use the array # positions to show the defaults for that number field. - elsif ($name =~ /^(\w+)(\d)$/) { + elsif ($name =~ /^(\w+)(?a:(\d))$/) { $default{$1}->[$2] = $values[0]; } else { diff --git a/quips.cgi b/quips.cgi index f8303c4231..3910041361 100755 --- a/quips.cgi +++ b/quips.cgi @@ -128,7 +128,7 @@ if ($action eq "delete") { || ThrowUserError("auth_failure", {group => "bz_quip_moderators", action => "delete", object => "quips"}); my $quipid = $cgi->param("quipid"); - ThrowCodeError("need_quipid") unless $quipid =~ /(\d+)/; + ThrowCodeError("need_quipid") unless $quipid =~ /(\d+)/a; $quipid = $1; check_hash_token($token, ['quips', $quipid]); diff --git a/report.cgi b/report.cgi index dfb0427646..87e700cc6a 100755 --- a/report.cgi +++ b/report.cgi @@ -153,9 +153,9 @@ foreach my $result (@$results) { $names{"row"}{$row}++; $names{"tbl"}{$tbl}++; - $col_isnumeric &&= ($col =~ /^-?\d+(\.\d+)?$/o); - $row_isnumeric &&= ($row =~ /^-?\d+(\.\d+)?$/o); - $tbl_isnumeric &&= ($tbl =~ /^-?\d+(\.\d+)?$/o); + $col_isnumeric &&= ($col =~ /^-?\d+(\.\d+)?$/ao); + $row_isnumeric &&= ($row =~ /^-?\d+(\.\d+)?$/ao); + $tbl_isnumeric &&= ($tbl =~ /^-?\d+(\.\d+)?$/ao); } my @col_names = get_names($names{"col"}, $col_isnumeric, $col_field); diff --git a/reports.cgi b/reports.cgi index f14d9855d8..b5f9be29da 100755 --- a/reports.cgi +++ b/reports.cgi @@ -174,7 +174,7 @@ sub generate_chart { my @line = split /\|/; my $date = $line[0]; - my ($yy, $mm, $dd) = $date =~ /^\d{2}(\d{2})(\d{2})(\d{2})$/; + my ($yy, $mm, $dd) = $date =~ /^\d{2}(\d{2})(\d{2})(\d{2})$/a; push @{$data{DATE}}, "$mm/$dd/$yy"; for my $i (1 .. $#fields) { diff --git a/scripts/build-bmo-push-data.pl b/scripts/build-bmo-push-data.pl index 8d8008e206..c4ed1dfce6 100755 --- a/scripts/build-bmo-push-data.pl +++ b/scripts/build-bmo-push-data.pl @@ -47,7 +47,7 @@ BEGIN } my $bug_id; - if ($message =~ /\bBug (\d+)/i) { + if ($message =~ /\bBug (\d+)/ai) { $bug_id = $1; } else { @@ -68,7 +68,7 @@ BEGIN if ($bug->{status} eq 'RESOLVED' && $bug->{resolution} ne 'FIXED') { next; } - if ($bug->{summary} =~ /\bbackport\s+(?:upstream\s+)?bug\s+(\d+)/i) { + if ($bug->{summary} =~ /\bbackport\s+(?:upstream\s+)?bug\s+(\d+)/ai) { my $upstream = $1; $bug->{summary} = fetch_bug($upstream)->{summary}; } diff --git a/scripts/cpanfile_fixed_versions.pl b/scripts/cpanfile_fixed_versions.pl index ac90120806..6aacea5832 100755 --- a/scripts/cpanfile_fixed_versions.pl +++ b/scripts/cpanfile_fixed_versions.pl @@ -45,7 +45,7 @@ sub _check_vers { # If we come here, then the version is not a valid one. # We try to sanitize it. - if ($vnum =~ /^((\d+)(\.\d+)*)/) { + if ($vnum =~ /^((\d+)(\.\d+)*)/a) { $vnum = $1; } } diff --git a/scripts/delete_comments_csv.pl b/scripts/delete_comments_csv.pl index 984b3424dc..5b31542b5a 100755 --- a/scripts/delete_comments_csv.pl +++ b/scripts/delete_comments_csv.pl @@ -37,7 +37,7 @@ my @values = $csv->fields(); next if !@values; my ($bug_id, $comment_id) = @values; - next if $bug_id !~ /^\d+$/; + next if $bug_id !~ /^\d+$/a; print "Deleting comment '$comment_id' from bug '$bug_id' "; my $bug = Bugzilla::Bug->check({id => $bug_id}); my $comment = Bugzilla::Comment->new($comment_id); diff --git a/scripts/fixgroupqueries.pl b/scripts/fixgroupqueries.pl index 9b0835b39e..2fe787d8a2 100755 --- a/scripts/fixgroupqueries.pl +++ b/scripts/fixgroupqueries.pl @@ -58,10 +58,10 @@ ($$) foreach my $row (@$query) { my ($id, $query) = @$row; - if ( ($query =~ /field\d+-\d+-\d+=bug_group/) - && ($query =~ /(?:^|&|;)value\d+-\d+-\d+=$old(?:;|&|$)/)) + if ( ($query =~ /field\d+-\d+-\d+=bug_group/a) + && ($query =~ /(?:^|&|;)value\d+-\d+-\d+=$old(?:;|&|$)/a)) { - $query =~ s/((?:^|&|;)value\d+-\d+-\d+=)$old(;|&|$)/$1$new$2/; + $query =~ s/((?:^|&|;)value\d+-\d+-\d+=)$old(;|&|$)/$1$new$2/a; $sth->execute($query, $id); $replace_count++; } @@ -94,10 +94,10 @@ ($$) foreach my $row (@$query) { my ($series_id, $query) = @$row; - if ( ($query =~ /field\d+-\d+-\d+=bug_group/) - && ($query =~ /(?:^|&|;)value\d+-\d+-\d+=$old(?:;|&|$)/)) + if ( ($query =~ /field\d+-\d+-\d+=bug_group/a) + && ($query =~ /(?:^|&|;)value\d+-\d+-\d+=$old(?:;|&|$)/a)) { - $query =~ s/((?:^|&|;)value\d+-\d+-\d+=)$old(;|&|$)/$1$new$2/; + $query =~ s/((?:^|&|;)value\d+-\d+-\d+=)$old(;|&|$)/$1$new$2/a; $sth->execute($query, $series_id); $replace_count++; } diff --git a/scripts/merge-users.pl b/scripts/merge-users.pl index 63be75c9c7..0f76c3eae6 100755 --- a/scripts/merge-users.pl +++ b/scripts/merge-users.pl @@ -54,7 +54,7 @@ =head1 SYNOPSIS # Make sure accounts were specified on the command line and exist. my $old = $ARGV[0] || die "You must specify an old user account.\n"; my $old_id; -if ($old =~ /^id:(\d+)$/) { +if ($old =~ /^id:(\d+)$/a) { # As the old user account may be a deleted one, we don't # check whether this user ID is valid or not. @@ -76,7 +76,7 @@ =head1 SYNOPSIS my $new = $ARGV[1] || die "You must specify a new user account.\n"; my $new_id; -if ($new =~ /^id:(\d+)$/) { +if ($new =~ /^id:(\d+)$/a) { $new_id = $1; # Make sure this user ID exists. diff --git a/show_bug.cgi b/show_bug.cgi index 679aa30fcb..54abf9d45b 100755 --- a/show_bug.cgi +++ b/show_bug.cgi @@ -76,12 +76,12 @@ if ($single) { push @bugs, Bugzilla::Bug->check({id => $id, cache => 1}); if (defined $cgi->param('mark')) { foreach my $range (split ',', $cgi->param('mark')) { - if ($range =~ /^(\d+)-(\d+)$/) { + if ($range =~ /^(\d+)-(\d+)$/a) { foreach my $i ($1 .. $2) { $marks{$i} = 1; } } - elsif ($range =~ /^(\d+)$/) { + elsif ($range =~ /^(\d+)$/a) { $marks{$1} = 1; } } diff --git a/showdependencygraph.cgi b/showdependencygraph.cgi index d2ec8c25b9..312c8aa086 100755 --- a/showdependencygraph.cgi +++ b/showdependencygraph.cgi @@ -58,7 +58,7 @@ my $CreateImagemap = sub { } if ($line - =~ /^rectangle \((\d+),(\d+)\) \((\d+),(\d+)\) (http[^ ]*) (\d+)(?:\\n.*)?$/) + =~ /^rectangle \((\d+),(\d+)\) \((\d+),(\d+)\) (http[^ ]*) (\d+)(?:\\n.*)?$/a) { my ($leftx, $rightx, $topy, $bottomy, $url, $bugid) = ($1, $3, $2, $4, $5, $6); diff --git a/showdependencytree.cgi b/showdependencytree.cgi index b4b9ab4cc9..f15b90b962 100755 --- a/showdependencytree.cgi +++ b/showdependencytree.cgi @@ -40,7 +40,7 @@ my $id = $bug->id; local our $hide_resolved = $cgi->param('hide_resolved') ? 1 : 0; local our $maxdepth = $cgi->param('maxdepth') || 0; -if ($maxdepth !~ /^\d+$/) { +if ($maxdepth !~ /^\d+$/a) { $maxdepth = 0; } diff --git a/testserver.pl b/testserver.pl index 4158059330..56f7de073e 100755 --- a/testserver.pl +++ b/testserver.pl @@ -45,7 +45,7 @@ foreach my $pscmd (@pscmds) { open PH, '-|', "$pscmd 2>/dev/null"; while (my $line = ) { - if ($line =~ /^(?:\S*\/)?(?:httpd|apache)2?\s+(\d+)$/) { + if ($line =~ /^(?:\S*\/)?(?:httpd|apache)2?\s+(?a:(\d+))$/) { $sgid = $1 if $1 > $sgid; } } @@ -56,7 +56,7 @@ # Determine the numeric GID of $webservergroup my $webgroupnum = 0; my $webservergroup = Bugzilla->localconfig->webservergroup; -if ($webservergroup =~ /^(\d+)$/) { +if ($webservergroup =~ /^(\d+)$/a) { $webgroupnum = $1; } else { @@ -239,7 +239,7 @@ sub fetch { } else { my ($host, $port, $file) = ('', 80, ''); - if ($url =~ m#^http://([^:]+):(\d+)(/.*)#i) { + if ($url =~ m#^http://([^:]+):(?a:(\d+))(/.*)#i) { ($host, $port, $file) = ($1, $2, $3); } elsif ($url =~ m#^http://([^/]+)(/.*)#i) { @@ -268,8 +268,8 @@ sub fetch { $content .= $line; } - my ($status) = $header =~ m#^HTTP/\d+\.\d+ (\d+)#; - $rtn = (($status =~ /^2\d\d/) ? $content : undef); + my ($status) = $header =~ m#^HTTP/(?a:\d+\.\d+) (?a:(\d+))#; + $rtn = (($status =~ /^2\d\d/a) ? $content : undef); } } return ($rtn); diff --git a/userprefs.cgi b/userprefs.cgi index 8fb6de2273..70c4a1636c 100755 --- a/userprefs.cgi +++ b/userprefs.cgi @@ -492,7 +492,7 @@ sub SaveEmail { # Remove any bug ids the user no longer wants to ignore foreach my $key (grep(/^remove_ignored_bug_/, $cgi->param)) { - my ($bug_id) = $key =~ /(\d+)$/; + my ($bug_id) = $key =~ /(\d+)$/a; delete $ignored_bugs{$bug_id}; } diff --git a/whine.pl b/whine.pl index d5ab2215e9..4d38804f51 100755 --- a/whine.pl +++ b/whine.pl @@ -133,7 +133,7 @@ if (&check_today($day)) { # Values that are not entirely numeric are intervals, like "30min" - if ($time !~ /^\d+$/) { + if ($time !~ /^\d+$/a) { # set it to now $sth = $dbh->prepare( @@ -176,7 +176,7 @@ # If configured for a particular time, set it to that, otherwise # midnight - my $target_time = ($time =~ /^\d+$/) ? $time : 0; + my $target_time = ($time =~ /^\d+$/a) ? $time : 0; my $run_next = $dbh->sql_date_math( @@ -560,11 +560,11 @@ sub reset_timer { # If the schedule is to run today, and it runs many times per day, # it shall be set to run immediately. $run_today = &check_today($run_day); - if (($run_today) && ($run_time !~ /^\d+$/)) { + if (($run_today) && ($run_time !~ /^\d+$/a)) { # The default of 60 catches any bad value my $minute_interval = 60; - if ($run_time =~ /^(\d+)min$/i) { + if ($run_time =~ /^(\d+)min$/ai) { $minute_interval = $1; } @@ -583,7 +583,7 @@ sub reset_timer { $minute_offset = 0; # Set the target time if it's a specific hour - my $target_time = ($run_time =~ /^\d+$/) ? $run_time : 0; + my $target_time = ($run_time =~ /^\d+$/a) ? $run_time : 0; my $nextdate = &get_next_date($run_day); my $run_next @@ -667,7 +667,7 @@ sub get_next_date { $add_days = 2; } } - elsif ($day !~ /^\d+$/) { # A specific day of the week + elsif ($day !~ /^\d+$/a) { # A specific day of the week # The default is used if there is a bad value in the database, in # which case we mark it to a less-popular day (Sunday) my $day_num = 0; diff --git a/xmlrpc.cgi b/xmlrpc.cgi index 8cfae0771a..cab4b6120e 100755 --- a/xmlrpc.cgi +++ b/xmlrpc.cgi @@ -51,7 +51,7 @@ $headers->parse("$header_str\r\n\r\n"); foreach my $name (@{$headers->names}) { $C->res->headers->header($name => $headers->header($name)); } -my ($code) = $headers->header('Status') =~ /^(\d+)/; +my ($code) = $headers->header('Status') =~ /^(\d+)/a; $C->res->code($code) if $code; $C->write($body); exit; diff --git a/xt/lib/Bugzilla/Test/Search/FieldTest.pm b/xt/lib/Bugzilla/Test/Search/FieldTest.pm index 77dbd3e47d..40858aee16 100644 --- a/xt/lib/Bugzilla/Test/Search/FieldTest.pm +++ b/xt/lib/Bugzilla/Test/Search/FieldTest.pm @@ -480,7 +480,7 @@ sub _translate_value { } # Sanity check to make sure that none of the <> stuff was left in. - if ($value =~ /<\d/) { + if ($value =~ /<\d/a) { die $self->name . ": value untranslated: $value\n"; } return $value; @@ -499,7 +499,7 @@ sub _translate_value_for_bug { $value =~ s/<$number-reporter>/$reporter/g; if ($value =~ /<$number-bug_group>/) { my @bug_groups = map { $_->name } @{$bug->groups_in}; - @bug_groups = grep { $_ =~ /^\d+-group-/ } @bug_groups; + @bug_groups = grep { $_ =~ /^\d+-group-/a } @bug_groups; my $group = $bug_groups[0]; $value =~ s/<$number-bug_group>/$group/g; }