Bug #76212 [Com]: Filter var URL with underscore in hostname
| From: | sjon at hortensius dot net | Date: | Thu, 12 Apr 2018 08:44:56 +0000 |
| Subject: | Bug #76212 [Com]: Filter var URL with underscore in hostname | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-214709@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76212&edit=1
ID: 76212
Comment by: sjon at hortensius dot net
Reported by: dimitri at sponsorboost dot com
Summary: Filter var URL with underscore in hostname
Status: Open
Type: Bug
Package: Filter related
Operating System: Windows (XAMPP)
PHP Version: 7.0.29
Block user comment: N
Private report: N
New Comment:
I think this explains it pretty good: https://stackoverflow.com/a/2183140/3749523
> for host names (or for URLs, which include a host name), [..] this is different, the relevant
> standard is RFC 1123, section 2.1 "Host Names and Numbers" which limits host names to
> letters-digits-hyphen.
Previous Comments:
------------------------------------------------------------------------
[2018-04-12 08:29:11] dimitri at sponsorboost dot com
Description:
------------
Hostname can't contain underscore '_'.
I find RFC norme : this https://tools.ietf.org/html/rfc3986#section-2.3
Test script:
---------------
var_dump(filter_var('http://testscript.com',FILTER_VALIDATE_URL));
var_dump(filter_var('http://test_script.com',FILTER_VALIDATE_URL));
Expected result:
----------------
string 'http://testscript.com'
string 'http://test_script.com'
Actual result:
--------------
string 'http://testscript.com'
boolean false
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76212&edit=1