From: Peter Rabbitson Date: Wed, 4 Nov 2015 03:42:17 +0000 (+0100) Subject: Replace \D with [^0-9] in sensitive spots X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f033dcbe3fd1c8e70a26151555fe1cf6fc55a37f;p=dbsrgits%2FDBIx-Class-Historic.git Replace \D with [^0-9] in sensitive spots --- diff --git a/lib/DBIx/Class/SQLMaker.pm b/lib/DBIx/Class/SQLMaker.pm index 25a0386..245847b 100644 --- a/lib/DBIx/Class/SQLMaker.pm +++ b/lib/DBIx/Class/SQLMaker.pm @@ -214,13 +214,13 @@ sub select { if (defined $offset) { $self->throw_exception('A supplied offset must be a non-negative integer') - if ( $offset =~ /\D/ or $offset < 0 ); + if ( $offset =~ /[^0-9]/ or $offset < 0 ); } $offset ||= 0; if (defined $limit) { $self->throw_exception('A supplied limit must be a positive integer') - if ( $limit =~ /\D/ or $limit <= 0 ); + if ( $limit =~ /[^0-9]/ or $limit <= 0 ); } elsif ($offset) { $limit = $self->__max_int; diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 40ae3f9..7908e3f 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -2431,12 +2431,12 @@ sub _select_args { # in case of a software_limit we'll never reach there) if (defined $attrs->{offset}) { $self->throw_exception('A supplied offset attribute must be a non-negative integer') - if ( $attrs->{offset} =~ /\D/ or $attrs->{offset} < 0 ); + if ( $attrs->{offset} =~ /[^0-9]/ or $attrs->{offset} < 0 ); } if (defined $attrs->{rows}) { $self->throw_exception("The rows attribute must be a positive integer if present") - if ( $attrs->{rows} =~ /\D/ or $attrs->{rows} <= 0 ); + if ( $attrs->{rows} =~ /[^0-9]/ or $attrs->{rows} <= 0 ); } elsif ($attrs->{offset}) { # MySQL actually recommends this approach. I cringe. diff --git a/lib/DBIx/Class/Storage/DBI/NoBindVars.pm b/lib/DBIx/Class/Storage/DBI/NoBindVars.pm index 281e67e..2ca9939 100644 --- a/lib/DBIx/Class/Storage/DBI/NoBindVars.pm +++ b/lib/DBIx/Class/Storage/DBI/NoBindVars.pm @@ -99,7 +99,7 @@ sub interpolate_unquoted { and $_[1] and - $_[2] !~ /\D/ + $_[2] !~ /[^0-9]/ and $_[1] =~ /int(?:eger)? | (?:tiny|small|medium|big)int/ix );