|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49197 FILTER_VALIDATE_URL does not validate urls
Submitted: 2009-08-08 14:32 UTC Modified: 2009-08-09 17:21 UTC
From: matt dot farina at gmail dot com Assigned:
Status: Not a bug Package: Filter related
PHP Version: 5.2.10 OS:
Private report: No CVE-ID: None
 [2009-08-08 14:32 UTC] matt dot farina at gmail dot com
FILTER_VALIDATE_URL doesn't actually validate a url. It passes the url 
through parse_url (which according to the documentation is not meant to 
validate a url). When tested against a test set this can be seen.

Instead of this method PHP should use a regex or some other method to 
actually validate it. See 
for an example that is to RFC 3986.

I would hope for PHP 6 we can have it look for a valid IRL (with 
international characters) as well.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-08-09 12:56 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

 [2009-08-09 17:21 UTC] matt dot farina at gmail dot com
The documentation at states that it 
"Validates value as URL, optionally with required components." It does 
not validate it to be a url. I setup a simple test and it validated 
invalid urls.

I may not have reported it properly through your process and it may not 
be the best solution but this is a bug. Either a documentation bug or a 
functionality bug. This is not proper validation!
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 14 13:01:27 2024 UTC