valitron
valitron copied to clipboard
integer validation fails for large numbers
I tried to validate &action=get&id=555555555555
and it fails. But &action=get&id=555
works fine. I keep getting Id must be an integer
That's strange :) Can you share a bit more of your code?
I know this is happening. It's because of php int range. Which is -2,147,483,647 - 2,147,483,647. So if I entered 2,147,483,648, it would fail.
The problem is that I tested this, and it validates:
$v = new \Valitron\Validator([
'num_1'=>'555555555555',
'num_2'=>'2147483648'
]);
$v->rule('integer', ['num_1', 'num_2']);
var_dump($v->validate()); //returns true
Hi,
I get false for the same test. Do you think this might be an issue with the php version of the platform php is on? I am running php 5.6.17 on IIS.