#47598 [Opn]: FILTER_VALIDATE_EMAIL is locale aware
| From: | mikael at bluemist dot se | Date: | Sun, 08 Mar 2009 13:25:01 +0000 |
| Subject: | #47598 [Opn]: FILTER_VALIDATE_EMAIL is locale aware | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-134481@lists.php.net to get a copy of this message | ||
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:
Sorry, expected result = actual result and actual = expected.
Previous Comments:
------------------------------------------------------------------------
[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