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

FilterVar casting result to bool #1346

Closed
tlangens opened this issue Mar 8, 2021 · 2 comments
Closed

FilterVar casting result to bool #1346

tlangens opened this issue Mar 8, 2021 · 2 comments

Comments

@tlangens
Copy link

tlangens commented Mar 8, 2021

PHP's filter_var returns filtered data or false if the filter fails. Respect\Validation's FilterVar uses Callback to call filter_var, which in turn casts the result to bool. The result of this is that if valid data from filter_var casts to false, the validator rejects the input even though it passed validation by filter_var.
For example:

filter_var('0', FILTER_VALIDATE_INT); // Valid input, returns 0, a valid integer.
(new FilterVar(FILTER_VALIDATE_INT))->validate('0'); // Valid input, returns false.
@alganet
Copy link
Member

alganet commented Feb 19, 2023

Duplicated here: #1387

A fix for it is already in place and targeted for the next release 🐼 I'll close this when it is on packagist.

@alganet alganet added this to the 2.3 milestone Feb 19, 2023
@alganet alganet self-assigned this Feb 19, 2023
@henriquemoody
Copy link
Member

Version 2.3 was released about a week ago.

I'm closing this now 🐼

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

No branches or pull requests

3 participants