forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Unicode characters in the local part of an e-mail address.
See RFC 6531 (https://tools.ietf.org/html/rfc6531). Encode IDNA domains. Add the missing "Done" to the expected output. Add the FILTER_FLAG_EMAIL_RFC6531 flag. Fix the filter_var() call.
- Loading branch information
Showing
4 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--TEST-- | ||
FILTER_VALIDATE_EMAIL unicode support (https://tools.ietf.org/html/rfc6531) | ||
--SKIPIF-- | ||
<?php if (!extension_loaded("filter")) die("skip"); ?> | ||
--FILE-- | ||
<?php | ||
$values = Array( | ||
'niceä[email protected]', | ||
'véry.ç[email protected]', | ||
'a.lîttle.lengthy.but.fiñ[email protected]', | ||
'dîsposable.style.é[email protected]', | ||
'other.é[email protected]', | ||
'üser@[IPv6:2001:db8:1ff::a0b:dbd0]', | ||
'"verî.uñ[email protected]ñusual.com"@example.com', | ||
'"verî.(),:;<>[]\".VERÎ.\"verî@\ \"verî\".unüsual"@strange.example.com', | ||
'té[email protected]', | ||
'té[email protected]', | ||
'té[email protected]', | ||
'té[email protected]', | ||
'té[email protected]', | ||
'tést@[255.255.255.255]', | ||
'tést@[IPv6:2001:0db8:85a3:08d3:1319:8a2e:0370:7344]', | ||
'tést@[IPv6:2001::7344]', | ||
'tést@[IPv6:1111:2222:3333:4444:5555:6666:255.255.255.255]', | ||
'té[email protected]', | ||
'üñîçøðé@example.com', | ||
'"üñîçøðé"@example.com', | ||
'DžǼ੧ఘⅧ⒇৪@example.com', | ||
); | ||
foreach ($values as $value) { | ||
var_dump(filter_var($value, FILTER_VALIDATE_EMAIL, FILTER_FLAG_EMAIL_RFC6531)); | ||
} | ||
echo "Done\n"; | ||
?> | ||
--EXPECT-- | ||
string(26) "niceä[email protected]" | ||
string(25) "véry.ç[email protected]" | ||
string(44) "a.lîttle.lengthy.but.fiñ[email protected]" | ||
string(48) "dîsposable.style.é[email protected]" | ||
string(34) "other.é[email protected]" | ||
string(35) "üser@[IPv6:2001:db8:1ff::a0b:dbd0]" | ||
string(43) ""verî.uñ[email protected]ñusual.com"@example.com" | ||
string(74) ""verî.(),:;<>[]\".VERÎ.\"verî@\ \"verî\".unüsual"@strange.example.com" | ||
string(17) "té[email protected]" | ||
string(23) "té[email protected]" | ||
string(24) "té[email protected]" | ||
string(18) "té[email protected]" | ||
string(23) "té[email protected]" | ||
string(23) "tést@[255.255.255.255]" | ||
string(52) "tést@[IPv6:2001:0db8:85a3:08d3:1319:8a2e:0370:7344]" | ||
string(23) "tést@[IPv6:2001::7344]" | ||
string(58) "tést@[IPv6:1111:2222:3333:4444:5555:6666:255.255.255.255]" | ||
string(27) "té[email protected]" | ||
string(26) "üñîçøðé@example.com" | ||
string(28) ""üñîçøðé"@example.com" | ||
string(31) "DžǼ੧ఘⅧ⒇৪@example.com" | ||
Done |