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
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.
Password:
Status:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2022 The PHP Group
All rights reserved.
Last updated: Mon May 23 00:03:41 2022 UTC