php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68049 filter_var echo wrong result for a url
Submitted: 2014-09-19 04:50 UTC Modified: -
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: luerfeng2012 at gmail dot com Assigned:
Status: Open Package: Strings related
PHP Version: 5.4Git-2014-09-19 (Git) OS: Windows 7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: luerfeng2012 at gmail dot com
New email:
PHP Version: OS:

 

 [2014-09-19 04:50 UTC] luerfeng2012 at gmail dot com
Description:
------------
5.4.28

Test script:
---------------
$url='http://dl_dir.qq.com/minigamefile/QQGameWorld.EXE';

if(filter_var($url,FILTER_VALIDATE_URL))
{
	echo 'valid url';
}else{
	echo 'invalid url';
}

Expected result:
----------------
valid url

Actual result:
--------------
invalid url

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-09-21 08:34 UTC] florian at margaine dot com
Hi,

This seems to be wanted behavior, see https://bugs.php.net/bug.php?id=51192

However, browsers *do* accepts underscores in the host.
 [2014-09-21 08:42 UTC] florian at margaine dot com
Another note: according to the rfc 3986, this is not a valid URL.

See: http://tools.ietf.org/html/rfc3986#section-3.2.2
 [2014-09-21 08:58 UTC] florian at margaine dot com
Also related: https://bugs.php.net/bug.php?id=68039
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Nov 12 07:01:37 2019 UTC