Edit report at https://bugs.php.net/bug.php?id=65141&edit=1

 ID:                 65141
 Comment by:         cmbecker69 at gmx dot de
 Reported by:        demtheman at yahoo dot com
 Summary:            filter_var() validates URL with two http:// as valid
 Status:             Open
 Type:               Bug
 Package:            URL related
 Operating System:   Windows 7 64-bit
 PHP Version:        5.3.26
 Block user comment: N
 Private report:     N

 New Comment:

According to RFC 2396 Appendix A the example URI doesn't seem to be valid, 
even if it passes the regular expression given in Appendix B.

However, filter_var($var, FILTER_VALIDATE_URL) is based on parse_url().
parse_url('http://http://example.com') evaluates to:
Array
(
    [scheme] => http
    [host] => http
    [path] => //example.com
)
This is apparently wrong in this case according to RFC 2396; neither an 
abs_path 
nor a rel_path must start with a double slash.


Previous Comments:
------------------------------------------------------------------------
[2013-06-27 03:39:05] demtheman at yahoo dot com

Description:
------------
I used filter_var() to validate the URL http://http://www.google.com (as test 
URL), however it seems to see it as valid which in fact is wrong. Refer to my 
SO 
question http://stackoverflow.com/questions/17333612/filter-var-accepts-invalid-
url

Test script:
---------------
$website = "http://http://www.google.com";;

echo filter_var($website, FILTER_VALIDATE_URL);

Expected result:
----------------
The filter_var() should return FALSE.

Actual result:
--------------
The filter_var() returns the filtered data.


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



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

Reply via email to