From 6d5f0ff9bacfb2f136aa55bca4d59f44c2074490 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 25 Oct 2023 12:38:12 +0100 Subject: [PATCH] validaiton math rounding - fixes #3761 --- CHANGELOG.md | 6 ++++++ system/src/Grav/Common/Data/Validation.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 674badd294..4bc53f6293 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v1.7.44 +## 10/02/2023 + +1. [](#bugfix) + * Fixed a math rounding issue with number validation when using floating point steps [#3761](https://github.com/getgrav/grav/issues/3761) + # v1.7.43 ## 10/02/2023 diff --git a/system/src/Grav/Common/Data/Validation.php b/system/src/Grav/Common/Data/Validation.php index daca7352f9..ea8ef2a0a9 100644 --- a/system/src/Grav/Common/Data/Validation.php +++ b/system/src/Grav/Common/Data/Validation.php @@ -550,7 +550,7 @@ public static function typeNumber($value, array $params, array $field) $step = (float)$params['step']; // Count of how many steps we are above/below the minimum value. $pos = ($value - $min) / $step; - + $pos = round($pos, 10); return is_int(static::filterNumber($pos, $params, $field)); }