forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path058.phpt
57 lines (57 loc) · 2.03 KB
/
058.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
--TEST--
FILTER_VALIDATE_EMAIL unicode support (https://tools.ietf.org/html/rfc6531)
--EXTENSIONS--
filter
--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_UNICODE));
}
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