Skip to content

Commit

Permalink
Proper float comparison in ratio validation (#17963)
Browse files Browse the repository at this point in the history
  • Loading branch information
vlakoff authored and taylorotwell committed Feb 17, 2017
1 parent 11d23b7 commit 0f5fd5d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Illuminate/Validation/Concerns/ValidatesAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ protected function failsRatioCheck($parameters, $width, $height)
[1, 1], array_filter(sscanf($parameters['ratio'], '%f/%d'))
);

return $numerator / $denominator != $width / $height;
return abs($numerator / $denominator - $width / $height) > 0.000001;
}

/**
Expand Down

0 comments on commit 0f5fd5d

Please sign in to comment.