#47598 [Opn]: FILTER_VALIDATE_EMAIL is locale aware
ID: 47598
User updated by: mikael at bluemist dot se
Reported By: mikael at bluemist dot se
Status: Open
Bug Type: Filter related
Operating System: Gentoo & Slackware
PHP Version: 5.2.9
New Comment:
After reading the RFC I realized characters like å ä ö (hex e5 e4 f6)
are not allowed (at least not unquoted). So the expected result should
be:
bool(false)
bool(false)
Previous Comments:
------------------------------------------------------------------------
[2009-03-08 13:25:00] mikael at bluemist dot se
Sorry, expected result = actual result and actual = expected.
------------------------------------------------------------------------
[2009-03-08 13:22:18] mikael at bluemist dot se
Description:
------------
FILTER_VALIDATE_EMAIL is locale aware and produces different results
depending on the locale set. Or more specific the \w escape sequence
used in the regular expression is locale aware.
From http://www.php.net/manual/en/regexp.reference.php:
"The definition of letters and digits is controlled by PCRE's character
tables, and may vary if locale-specific matching is taking place. For
example, in the "fr" (French) locale, some character codes greater than
128 are used for accented letters, and these are matched by \w."
Reproduce code:
---------------
setlocale(LC_CTYPE, 'C');
var_dump(filter_var('åäö@example.com', FILTER_VALIDATE_EMAIL));
setlocale(LC_CTYPE, 'sv_SE');
var_dump(filter_var('åäö@example.com', FILTER_VALIDATE_EMAIL));
Expected result:
----------------
bool(false)
string(15) "åäö@example.com"
Actual result:
--------------
string(15) "åäö@example.com"
string(15) "åäö@example.com"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47598&edit=1
Thread (5 messages)