Closed
Description
- Laravel Version: 5.8
- PHP Version: 7.2
- Database Driver & Version:
Description:
Email validator in Laravel 5.8 accept email with wrong domain part.
Steps To Reproduce:
- Install Laravel 5.8
- Add base authorization. You will have in RegisterController next function:
protected function validator(array $data)
{
return Validator::make($data, [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'string', 'min:6', 'confirmed'],
]);
}
- Try to Register with email "sadada@fsfdsfsdfds"- the domain part is not full.
- Validator will accept email.
Laravel 5.7 is working fine.
Let's check the code in 5.7 and 5.8, file ValidatesAttributes.php
Laravel 5.7 (working, standard php function):
public function validateEmail($attribute, $value)
{
return filter_var($value, FILTER_VALIDATE_EMAIL) !== false;
}
Laravel 5.8 (not working, something custom now):
public function validateEmail($attribute, $value)
{
if (! is_string($value) && ! (is_object($value) && method_exists($value, '__toString'))) {
return false;
}
return (new EmailValidator)->isValid($value, new RFCValidation);
}
Metadata
Metadata
Assignees
Labels
No labels