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 Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
36 + 5 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 21:01:31 2024 UTC