|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47598 FILTER_VALIDATE_EMAIL is locale aware
Submitted: 2009-03-08 13:22 UTC Modified: 2009-03-08 18:25 UTC
From: mikael at bluemist dot se Assigned: iliaa (profile)
Status: Closed Package: Filter related
PHP Version: 5.2.9 OS: Gentoo & Slackware
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: mikael at bluemist dot se
New email:
PHP Version: OS:


 [2009-03-08 13:22 UTC] mikael at bluemist dot se
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.

"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('???', FILTER_VALIDATE_EMAIL));
setlocale(LC_CTYPE, 'sv_SE');
var_dump(filter_var('???', FILTER_VALIDATE_EMAIL));

Expected result:
string(15) "???"

Actual result:
string(15) "???"
string(15) "???"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-03-08 13:25 UTC] mikael at bluemist dot se
Sorry, expected result = actual result and actual = expected.
 [2009-03-08 13:55 UTC] mikael at bluemist dot se
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:
 [2009-03-08 18:25 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Oct 16 11:03:33 2021 UTC