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: 2020-04-07 14:26 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: luerfeng2012 at gmail dot com Assigned: cmb (profile)
Status: Duplicate Package: Strings related
PHP Version: 5.4Git-2014-09-19 (Git) OS: Windows 7
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 you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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
 [2020-04-07 14:26 UTC] cmb@php.net
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2020-04-07 14:26 UTC] cmb@php.net
Duplicate of bug #64948.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 05 02:01:30 2024 UTC