Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Email-Valid CPAN distribution.

Report information
The Basics
Id: 50230
Status: resolved
Priority: 0/
Queue: Email-Valid

People
Owner: Nobody in particular
Requestors: ferreira [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.182
Fixed in: (no value)



Subject: Refuse utf-8 email addresses
Currently, Email::Valid 0.182 accepts utf-8 emails like adriano-uğur@blah.com That happens because the code checks for patterns like [^\x80-\xff] which will pass on utf8 chars that are not in latin-1. For example, running the test: ### use strict; use warnings; use Test::More tests => 2; use Email::Valid (); ok( Email::Valid->address("adriano-f\xE9res\@blah.com") ); ok( Email::Valid->address("adriano-u\x{11F}ur\@blah.com") ); ### outputs $ prove -v utf8-addresses.t utf8-addresses.... 1..2 not ok 1 # Failed test at utf8-addresses.t line 9. ok 2 # Looks like you failed 1 test of 2. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/2 subtests Test Summary Report ------------------- utf8-addresses (Wstat: 256 Tests: 2 Failed: 1) Failed test: 1 Non-zero exit status: 1 Files=1, Tests=2, 0 wallclock secs ( 0.02 usr 0.00 sys + 0.03 cusr 0.00 csys = 0.05 CPU) Result: FAIL but both adriano-féres@blah.com and adriano-uğur@blah.com are bad e-mail addresses. A simple change to make that work is to add "use bytes;" below "use warnings;" in Email/Valid.pm, turning bytewise interpretation of all regexes in the code.
Rather than use the hateful bytes.pm, I have addressed this by asserting that an email address must not match /\P{ASCII}/ when it is being checked against the email regex. -- rjbs