php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55800 FILTER_VALIDATE_URL validates wrong
Submitted: 2011-09-27 13:28 UTC Modified: 2011-09-27 22:13 UTC
From: giuseppem at gmail dot com Assigned:
Status: Not a bug Package: Filter related
PHP Version: Irrelevant OS: Ubuntu 11.04
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:
22 - 15 = ?
Subscribe to this entry?

 
 [2011-09-27 13:28 UTC] giuseppem at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.filter-var
---

FILTER_VALIDATE_URL validates wrong when you set two or more urls together, for 
example:

$url = 'http://php.net/http://bugs.php.net/';

I'm using PHP version 5.3.5

Test script:
---------------
<?php
$url = 'http://php.net/http://bugs.php.net/';
var_dump(filter_var($url, FILTER_VALIDATE_URL));
?>

Expected result:
----------------
bool(false)

Actual result:
--------------
string(35) "http://php.net/http://bugs.php.net/"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-09-27 17:44 UTC] aharvey@php.net
-Status: Open +Status: Bogus
 [2011-09-27 17:44 UTC] aharvey@php.net
That's a valid URL: in this case, the path component is http://bugs.php.net/, and 
that's explicitly allowed by RFC 3986 -- path components can include colons.
 [2011-09-27 22:13 UTC] giuseppem at gmail dot com
Oh. I was thinking that was <scheme>://<authority>/<scheme>://<authority> and not 
the path. Now it's clear, thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 02:01:29 2024 UTC