php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76212 Filter var URL with underscore in hostname
Submitted: 2018-04-12 08:29 UTC Modified: 2018-04-12 09:15 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: dimitri at sponsorboost dot com Assigned:
Status: Not a bug Package: Filter related
PHP Version: 7.0.29 OS: Windows (XAMPP)
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dimitri at sponsorboost dot com
New email:
PHP Version: OS:

 

 [2018-04-12 08:29 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-04-12 08:44 UTC] sjon at hortensius dot net
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.
 [2018-04-12 08:48 UTC] spam2 at rhsoft dot net
just don't do that - countless developer hours are wasted in the past years because of such hostnames and then finally test in different browsers and find out after hhours that MSIE don't like cookies for hostnames which must not exist
 [2018-04-12 09:15 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2018-04-12 09:15 UTC] requinix@php.net
As commented.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 10 14:01:27 2024 UTC