Skip to content

Commit

Permalink
Restrict comparison against hardcoded integers
Browse files Browse the repository at this point in the history
  • Loading branch information
Alymosul committed May 3, 2018
1 parent 411fc1d commit 47580bf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Illuminate/Validation/Concerns/ValidatesAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ public function validateGt($attribute, $value, $parameters)

$comparedToValue = $this->getValue($parameters[0]);

if (is_null($comparedToValue) && is_numeric($parameters[0])) {
if (is_null($comparedToValue) && (is_numeric($value) && is_numeric($parameters[0]))) {
return $this->getSize($attribute, $value) > $parameters[0];
}

Expand All @@ -481,7 +481,7 @@ public function validateLt($attribute, $value, $parameters)

$comparedToValue = $this->getValue($parameters[0]);

if (is_null($comparedToValue) && is_numeric($parameters[0])) {
if (is_null($comparedToValue) && (is_numeric($value) && is_numeric($parameters[0]))) {
return $this->getSize($attribute, $value) < $parameters[0];
}

Expand All @@ -504,7 +504,7 @@ public function validateGte($attribute, $value, $parameters)

$comparedToValue = $this->getValue($parameters[0]);

if (is_null($comparedToValue) && is_numeric($parameters[0])) {
if (is_null($comparedToValue) && (is_numeric($value) && is_numeric($parameters[0]))) {
return $this->getSize($attribute, $value) >= $parameters[0];
}

Expand All @@ -527,7 +527,7 @@ public function validateLte($attribute, $value, $parameters)

$comparedToValue = $this->getValue($parameters[0]);

if (is_null($comparedToValue) && is_numeric($parameters[0])) {
if (is_null($comparedToValue) && (is_numeric($value) && is_numeric($parameters[0]))) {
return $this->getSize($attribute, $value) <= $parameters[0];
}

Expand Down

0 comments on commit 47580bf

Please sign in to comment.