php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65630 filter_var() return false with german umlauts
Submitted: 2013-09-07 16:16 UTC Modified: 2014-02-19 06:41 UTC
Votes:5
Avg. Score:4.4 ± 0.5
Reproduced:5 of 5 (100.0%)
Same Version:5 (100.0%)
Same OS:5 (100.0%)
From: marvin-wegener at outlook dot com Assigned:
Status: Not a bug Package: Filter related
PHP Version: 5.5.3 OS: Windows/Linux
Private report: No CVE-ID: None
 [2013-09-07 16:16 UTC] marvin-wegener at outlook dot com
Description:
------------
Hello,

If I use the following script, the filter_var return always false, but the Domain is possible.

It is possible to fix it, that Domains with ÜÖÄ are exepted?

Thanks you in advance!

Test script:
---------------
<?php
if(filter_var('example@öko.de', FILTER_VALIDATE_EMAIL))
{
	echo 'ok';
}
else
{
	echo 'fail';
}
?>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-09-08 21:42 UTC] cmbecker69 at gmx dot de
Unfortunately, the manual[1] is not explicit about that issue, 
but I assume that FILTER_VALIDATE_EMAIL validates according to
RFC 5322, which does not cater for IDNs.  If so, this might be
regarded as "documentation problem".

This bug report is related to request #65385[2].

[1] <http://www.php.net/manual/en/filter.filters.validate.php>
[2] <https://bugs.php.net/bug.php?id=65385>
 [2013-09-09 04:40 UTC] pajoye@php.net
-Status: Open +Status: Not a bug
 [2014-02-18 13:53 UTC] strahil at gmail dot com
Actually the problem persist with other filters as well. For example, this URL:

https://www.kfw.de/KfW-Konzern/Karriere/Jobs-Bewerbung/Jobbörse/Vertrieb/

filter_var($url, FILTER_VALIDATE_URL) would return false, but it's a valid URL.

So this indeed is a bug.
 [2014-02-18 14:13 UTC] cmbecker69 at gmx dot de
According to RFC 3986[1] your example is not a valid URI, because
the path component must not contain an Umlaut; the ö would have to
be percent encoded as %C3%B6 (what is done transparently by modern
browsers). Passing the proper URL to filter_var($url,
FILTER_VALIDATE_URL) has the expected result.

[1] <https://tools.ietf.org/html/rfc3986>
 [2014-02-19 06:41 UTC] pajoye@php.net
Exactly, use the IDN functions or url_encode.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 05 02:01:30 2024 UTC