valitron
valitron copied to clipboard
Non-breaking space
$v = new Validator(['name' => "\xc2\xa0"]);
$v->rule('required', 'name');
if($v->validate()) {
echo "Yay! We're all good!";
} else {
// Errors
print_r($v->errors());
}
output: Yay! We're all good!
I think this behavior is okay. In this situation, we expect to have a name field in our request body and the value of the name field is not essential for us only the existence of the name field is necessary.