Closed nchizhov closed 1 year ago
You are absolutely right. Thanks for reporting 🐼 Sorry about the 6-month delay for the response, we were lacking time to dedicate to the project.
The filter_var
function is more of a sanitizer, but we as a validation library do not care for that use case.
This issue was being caused because the FilterVar
validator reuses the Callback
validator in an envelope, and Callback
casts the result to boolean. It caused this weird scenario in which the int 0 would be treated as false.
I've made the fix targeting release 2.3.
I'll be closing this once there is a release candidate.
If using filterVal with FILTER_VALIDATE_INT and validate (0, '0') its returns false, but should returns true;
Example:
returns false
But if will try to use php's filterVal:
returns correct true.