Skip to content

Use of uninitialized value $tld in hash element #38

@AlessandroGorohovski

Description

@AlessandroGorohovski

Dear Ricardo,

I found that
Email::Valid->address( -address => 'guest@xn--c1ad6a.xn--p1ai', -tldcheck => 1 );
causes warnings in Email::Valid.pm module:

Use of uninitialized value $tld in hash element at /usr/local/share/perl/5.18.2/Email/Valid.pm line 234.
Use of uninitialized value $_[0] in lc at /usr/local/share/perl/5.18.2/Net/Domain/TLD.pm line 2033.

I think the problem with line 234:

$ head -n 234 Valid.pm | tail -n 5

  1. my ($tld) = $host =~ m#.(\w+)$#;
  2. my %invalid_tlds = map { $_ => 1 } qw(invalid test example localhost);
  3. return defined $invalid_tlds{$tld} ? 0 : Net::Domain::TLD::tld_exists($tld);

due to lack of undef control after
my ($tld) = $host =~ m#.(\w+)$#.

Regards,
Alessandro

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions