Repository: laravel/framework (php)

Issue:
Rules digits and digits_between don't work with fractional numbers
- Laravel Version: 5.2 and later

### Description:
I believe that the fix on this [issue](https://github.com/laravel/framework/issues/14647) should not have been approved. The rules now only supports integer values. And this does not match the description in the documentation: "The field under validation **must be numeric** and must have an exact length of value."

### Steps To Reproduce:

```php
<?php

$validator = Validator::make(
    ['fractional_value' => 1.2],
    ['fractional_value' => 'digits_between:1,10']
);
$validator->errors()->first(); // The fractional value must be between 1 and 10 digits.


Pull request description:
[6.x] Fix digits_between with fractions
At the moment the `digits_between` validation rule didn't validate digits with fractions properly. #14650 already added support for special numbers with scientific notation but fractions weren't supported until now. I believe it's expected to also accommodate for digits with fractions and not just integers.

Fixes #40264

Patch:
diff --git a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php b/src/Illuminate/Validation/Concerns/ValidatesAttributes.php
index 358a3cc833..67526a81bb 100644
--- a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php
+++ b/src/Illuminate/Validation/Concerns/ValidatesAttributes.php
@@ -486,7 +486,7 @@ public function validateDigitsBetween($attribute, $value, $parameters)
 
         $length = strlen((string) $value);
 
-        return ! preg_match('/[^0-9]/', $value)
+        return ! preg_match('/[^0-9.]/', $value)
                     && $length >= $parameters[0] && $length <= $parameters[1];
     }
 


Test patch:
diff --git a/tests/Validation/ValidationValidatorTest.php b/tests/Validation/ValidationValidatorTest.php
index 8676d5f71d..8f0c294c4b 100755
--- a/tests/Validation/ValidationValidatorTest.php
+++ b/tests/Validation/ValidationValidatorTest.php
@@ -1767,6 +1767,12 @@ public function testValidateDigits()
 
         $v = new Validator($trans, ['foo' => '+12.3'], ['foo' => 'digits_between:1,6']);
         $this->assertFalse($v->passes());
+
+        $v = new Validator($trans, ['foo' => '1.2'], ['foo' => 'digits_between:1,10']);
+        $this->assertTrue($v->passes());
+
+        $v = new Validator($trans, ['foo' => '0.9876'], ['foo' => 'digits_between:1,5']);
+        $this->assertTrue($v->fails());
     }
 
     public function testValidateSize()