php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #2393 Can't use parse_url for url validation
Submitted: 1999-09-27 19:06 UTC Modified: 2002-10-01 14:54 UTC
From: bram at guts dot nl Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 3.0.12 OS: Linux
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: bram at guts dot nl
New email:
PHP Version: OS:

 

 [1999-09-27 19:06 UTC] bram at guts dot nl
I use parse_url() to validate url's.

But that does not work in my opinion very wel..

<?
$url=parse_url("http://this is no host");
print $url["host"];
?>
print's out :

this is no host

That's not a valid host.

It should be cool if parse_url did some regexp to check.

Bram

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-07-22 17:06 UTC] andy@php.net
reclassified
 [2002-10-01 14:54 UTC] hholzgra@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

as stated in the manual: parse_url() will try to parse even incomplete urls. it is meant for input parsing, not for validation
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Sep 18 13:03:38 2021 UTC