-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Description
There isn't an implementation for validate for emails, so although an empty string will be correctly filtered to null, it will validate as true, which is not desirable.
Repro code:
$filter = \Filterus\Filter::factory('email');
$result = $filter->filter('');
var_dump($result); // Returns NULL, correct
$ok = $filter->validate('');
echo $ok ? 'Passed' : 'Failed'; // Incorrectly returns Passed
A solution for now is to use a chain, like so:
$filter = \Filterus\Filter::chain('email', 'string,min:1');
$result = $filter->filter('');
var_dump($result); // Returns NULL, correct
$ok = $filter->validate('');
echo $ok ? 'Passed' : 'Failed'; // Correctly returns Failed
Metadata
Metadata
Assignees
Labels
No labels