-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: stop using is_string() for validation (#233)
Stop using is_string() for validation as it fails for strings that have automatically been converted into integers when used as keys in associative arrays. Update isNullOrEmpty to check if the given value is a scalar (a string, int, float, or bool) and then check if its string value is empty instead of explicitly taking a string. Remove a dictionary set fields test case that checks for an error when given this array: [""]. PHP will implicitly treat it as this associative array: [0 => ""], which is valid with our new validation. We need to choose whether to support integer string keys or whether to be able to reject this specific type of invalid input.
- Loading branch information
Showing
2 changed files
with
9 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters