php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #40675 Documentation for FILTER_VALIDATE_URL appears out of date
Submitted: 2007-03-01 03:07 UTC Modified: 2007-08-17 10:56 UTC
Votes:1
Avg. Score:2.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: walter dot tom+php at gmail dot com Assigned: pajoye (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.2.1 OS:
Private report: No CVE-ID: None
 [2007-03-01 03:07 UTC] walter dot tom+php at gmail dot com
Description:
------------
The current documentation for FILTER_VALIDATE_URL (http://www.php.net/filter) mentions flags for FILTER_FLAG_HOST_REQUIRED and FILTER_FLAG_SCHEME_REQUIRED, which suggest that an input that doesn't include a host or scheme such as a relative URL SHOULD validate as long as it doesn't include those flags. However they do not.




Reproduce code:
---------------
$var = filter_var('/mypath.html', FILTER_VALIDATE_URL);
$var = filter_var('google.com', FILTER_VALIDATE_URL);

Expected result:
----------------
Both return false, however given the current documentation, one would expect them to return true.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-03-01 03:09 UTC] walter dot tom+php at gmail dot com
Oops, for some reason lost the version number when I first submitted.
 [2007-03-01 16:51 UTC] philip@php.net
You bring up some good points. After briefly speaking with Pierre the following came to light:

* The default behavior of FILTER_VALIDATE_URL was changed at some point
* FILTER_FLAG_SCHEME_OPTIONAL should exist instead
* Likely the same to create FILTER_FLAG_HOST_OPTIONAL, he'll look
* So, at first glance, those two _REQUIRED constants have no meaning today

As requested, this bug is being assigned to Pierre and he'll work on it this weekend. Thank you for the nice bug report :)
 [2007-03-01 22:34 UTC] walter dot tom+php at gmail dot com
Thanks for responding so quickly!

BTW I also added a feature suggestion #40676 that maybe a FILTER_VALIDATE_URI option could be added that would possibly be a good alternative to URL, since technically the RFC for a 'URL' does require it to have a host and scheme.

I thought I should mention it since I get the impression that the reason the scheme and host required flags were removed originally was because of this.

But either way I'm just happy as long as I can validate domains and relative URLs somehow. Thanks for your good work!

Cheers
Tom
 [2007-08-17 10:56 UTC] vrana@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

Constants from the description of FILTER_VALIDATE_URL removed.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 20:01:25 2019 UTC