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

Fix: boolean rule to check if value is a boolean #17

Merged
merged 1 commit into from
Aug 15, 2023

Conversation

jonwaldstein
Copy link
Contributor

Resolves: #16

This prevents the boolean rule from returning false positives by adding an is_bool check and FILTER_NULL_ON_FAILURE flag to filter_var.

After using filter_var to determine the boolean value we use is_bool to check if the value is a boolean. With the addition of the filter flag FILTER_NULL_ON_FAILURE,filter_var will now return null on failure - causing is_bool to return false.

@jonwaldstein
Copy link
Contributor Author

@JasonTheAdams this is ready for review.

Copy link
Contributor

@JasonTheAdams JasonTheAdams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, @jonwaldstein! And thanks for updating the tests!

@JasonTheAdams JasonTheAdams merged commit 137d152 into develop Aug 15, 2023
1 check passed
@JasonTheAdams JasonTheAdams deleted the fix/boolean-rule branch August 15, 2023 15:19
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

Successfully merging this pull request may close these issues.

Boolean rule should validate the value as boolean
2 participants