Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Bugzilla/App/Plugin/Glue.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions Bugzilla/App/Plugin/Hostage.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions Bugzilla/Bug.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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});
}

Expand Down
8 changes: 4 additions & 4 deletions Bugzilla/BugMail.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down Expand Up @@ -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;
4 changes: 2 additions & 2 deletions Bugzilla/BugUrl/Aha.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Bugzilla/BugUrl/Debian.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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$/) {
Expand Down
4 changes: 2 additions & 2 deletions Bugzilla/BugUrl/Edge.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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"});
}
Expand Down
2 changes: 1 addition & 1 deletion Bugzilla/BugUrl/GitHub.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion Bugzilla/BugUrl/GitLab.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion Bugzilla/BugUrl/JIRA.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion Bugzilla/BugUrl/Launchpad.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Bugzilla/BugUrl/MantisBT.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion Bugzilla/BugUrl/MozSentry.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion Bugzilla/BugUrl/MozSupport.pm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ sub should_handle {
# Mozilla support questions normally have the form:
# https://support.mozilla.org/<language>/questions/<id>
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 {
Expand Down
2 changes: 1 addition & 1 deletion Bugzilla/BugUrl/Phabricator.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion Bugzilla/BugUrl/Splat.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion Bugzilla/BugUrl/Trac.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion Bugzilla/BugUrl/WebCompat.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions Bugzilla/CGI.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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')
{
Expand All @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions Bugzilla/Chart.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Bugzilla/Comment.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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});
Comment thread
mrenvoize marked this conversation as resolved.
return $tag;
}

Expand Down
2 changes: 1 addition & 1 deletion Bugzilla/Config/Common.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down
6 changes: 3 additions & 3 deletions Bugzilla/DB/Oracle.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Bugzilla/DB/Pg.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Bugzilla/DB/Schema/MariaDB.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Bugzilla/DB/Schema/Mysql.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Bugzilla/Error.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions Bugzilla/Extension.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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});
}
Expand All @@ -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});
}
Expand Down
6 changes: 3 additions & 3 deletions Bugzilla/Flag.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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));

Expand Down
2 changes: 1 addition & 1 deletion Bugzilla/FlagType.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down
Loading
Loading