Framework: The Email validation is not working correct !!!

Created on 23 Apr 2019  路  4Comments  路  Source: laravel/framework

  • Laravel Version: 5.8.14
  • PHP Version: 7.3.4
  • Database Driver & Version: No need

Description:

In previous versions of Laravel, I remember only emails like [email protected] will pass the Validation.
Now emails like name@domain are valid ?

Steps To Reproduce:

Route::get('/', function () {

    $request = [
        'field' => 'n@d', // invalid email address
    ];

    $validator = Validator::make($request, [
        'field' => 'email',
    ]);

    if ($validator->fails()) {
        // We need to reach this point and the validation need to fail.
        dd('VALIDATION FAILS');
    }


    // Unfortunately the validation passes :(
    return 'VALIDATION PASSES';
});

Most helpful comment

For those still having issues with this, use this 'email' => 'email:filter' which uses the filter_var() method under the hood to check if the email is valid. Refer to https://laravel.com/docs/5.8/validation#rule-email for other email validation types .

All 4 comments

That is a valid email

OK. I see.
One email address don't need to have a TLD to be valid... new stuff.

For those still having issues with this, use this 'email' => 'email:filter' which uses the filter_var() method under the hood to check if the email is valid. Refer to https://laravel.com/docs/5.8/validation#rule-email for other email validation types .

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shopblocks picture shopblocks  路  3Comments

PhiloNL picture PhiloNL  路  3Comments

YannPl picture YannPl  路  3Comments

Anahkiasen picture Anahkiasen  路  3Comments

iivanov2 picture iivanov2  路  3Comments