Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RE: Emails with no top level domain suffix are coming through as valid #359

Open
bretto36 opened this issue Feb 7, 2023 · 5 comments
Open
Assignees
Labels

Comments

@bretto36
Copy link

bretto36 commented Feb 7, 2023

I'm using Laravel, which utilizes this library under the hood. I have an email which is coming through as valid but i don't think it should be. I'm not across the current standard oh what constitutes a valid email, but i assume it would need a top level suffix of some sort.

sales@test is the email that comes back as valid

$email = 'sales@test';

        $validator = \Validator::make(['email' => $email], [
            'email' => 'required|email',
        ]);

        try {
            $validator->validate();
        } catch (\Exception $e) {
            dd('invalid');
        }

        dd('valid');
@FrazeColder
Copy link

Please take a look at this, I am facing the same issue here!

@joleenshook
Copy link

Same issue. If this is expected behavior, please give us a simple way to override it.

@MatthieuScarset
Copy link

+1 to have a proper way to override this.

Having the same issue with this library in Drupal.

@egulias
Copy link
Owner

egulias commented Apr 4, 2023

Hi folks. Apologies for the delay.
This is the expected behaviour, as email RFCs do not explicitly state there should be a TLD.

Now, reflecting on this and given that I'm following RFC 1035 for the domain part, it is true it should require to have a TLD.

Will work on this.

@nikspyratos
Copy link

I'm not well versed in creating & using lexers, but I'm going to guess the issue lies here as that's the only place $tldMissing is set to false, when it should be true in an example@notld input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants