Bug #65630 [Nab]: filter_var() return false with german umlauts
Edit report at https://bugs.php.net/bug.php?id=65630&edit=1
ID: 65630
Updated by: pajoye@php.net
Reported by: marvin-wegener at outlook dot com
Summary: filter_var() return false with german umlauts
Status: Not a bug
Type: Bug
Package: Filter related
Operating System: Windows/Linux
PHP Version: 5.5.3
Block user comment: N
Private report: N
New Comment:
Exactly, use the IDN functions or url_encode.
Previous Comments:
------------------------------------------------------------------------
[2014-02-18 14:13:17] 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-18 13:53:56] 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.
------------------------------------------------------------------------
[2013-09-09 04:40:08] pajoye@php.net
You have to use http://php.net/manual/en/function.idn-to-ascii.php
------------------------------------------------------------------------
[2013-09-08 21:42:03] 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-07 16:16:08] 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';
}
?>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65630&edit=1
Thread (6 messages)