Skip to content

Commit be0c772

Browse files
committed
Merge branch '6.x' into 8.x
2 parents 26bfb14 + 36eff92 commit be0c772

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/Illuminate/Validation/Concerns/ValidatesAttributes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ public function validateDigitsBetween($attribute, $value, $parameters)
555555

556556
$length = strlen((string) $value);
557557

558-
return ! preg_match('/[^0-9]/', $value)
558+
return ! preg_match('/[^0-9.]/', $value)
559559
&& $length >= $parameters[0] && $length <= $parameters[1];
560560
}
561561

tests/Validation/ValidationValidatorTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2284,6 +2284,12 @@ public function testValidateDigits()
22842284

22852285
$v = new Validator($trans, ['foo' => '+12.3'], ['foo' => 'digits_between:1,6']);
22862286
$this->assertFalse($v->passes());
2287+
2288+
$v = new Validator($trans, ['foo' => '1.2'], ['foo' => 'digits_between:1,10']);
2289+
$this->assertTrue($v->passes());
2290+
2291+
$v = new Validator($trans, ['foo' => '0.9876'], ['foo' => 'digits_between:1,5']);
2292+
$this->assertTrue($v->fails());
22872293
}
22882294

22892295
public function testValidateSize()

0 commit comments

Comments
 (0)