ID:              40675
 User updated by: walter dot tom+php at gmail dot com
 Reported By:     walter dot tom+php at gmail dot com
 Status:          Assigned
 Bug Type:        Documentation problem
 PHP Version:     5.2.1
 Assigned To:     pajoye
 New Comment:

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


Previous Comments:
------------------------------------------------------------------------

[2007-03-01 16:51:15] [EMAIL PROTECTED]

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 03:09:03] walter dot tom+php at gmail dot com

Oops, for some reason lost the version number when I first submitted.

------------------------------------------------------------------------

[2007-03-01 03:07:10] 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.



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=40675&edit=1

Reply via email to