Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integer validation fails for large numbers #300

Open
hirani89 opened this issue Dec 5, 2019 · 4 comments
Open

integer validation fails for large numbers #300

hirani89 opened this issue Dec 5, 2019 · 4 comments

Comments

@hirani89
Copy link

hirani89 commented Dec 5, 2019

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

@willemwollebrants
Copy link
Collaborator

That's strange :) Can you share a bit more of your code?

@hirani89
Copy link
Author

hirani89 commented Dec 8, 2019

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.

@willemwollebrants
Copy link
Collaborator

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 

@hirani89
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants