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

 ID:               51305
 User updated by:  rakan dot alhneiti at gmail dot com
 Reported by:      rakan dot alhneiti at gmail dot com
 Summary:          filter_var returns false on valid URLs
 Status:           Duplicate
 Type:             Bug
 Package:          Filter related
 Operating System: Redhat
 PHP Version:      5.2.13

 New Comment:

yup i've upgraded my version of php a couple of days ago via compiling
the latest php 5.2.13 source and this happened. and as you can see the
fix came after the release


Previous Comments:
------------------------------------------------------------------------
[2010-03-16 10:17:33] ahar...@php.net

This was fixed after 5.2.13 was released, so yes, 5.2.13 would be
affected.

------------------------------------------------------------------------
[2010-03-16 10:07:28] j...@php.net

Are you really using 5.2.13? I definately am and this test script of
yours returns the url as expected.

------------------------------------------------------------------------
[2010-03-16 10:05:45] ahar...@php.net

Already fixed in SVN, per bug #51192.

------------------------------------------------------------------------
[2010-03-16 09:52:50] rakan dot alhneiti at gmail dot com

Description:
------------
Hello,



I am currently testing script attached which is supposed to validate
URLs



The URL as you can see is a valid URL but the 4 var_dump's done return
false. Here is a test run result:



string(29) "http://my-domain.mydomain.com";

bool(false)

bool(false)

bool(false)

bool(false)



I tested my_domain.mydomain.com and it returned the domain correctly.
while on the '-' dash sign it returns false



Test script:
---------------
<?php

        $URL = "http://my-domain.mydomain.com";;

        var_dump($URL);

        var_dump(filter_var($URL, FILTER_VALIDATE_URL));

        var_dump(filter_var($URL, FILTER_VALIDATE_URL,
FILTER_FLAG_SCHEME_REQUIRED));

        var_dump(filter_var($URL, FILTER_VALIDATE_URL,
FILTER_FLAG_HOST_REQUIRED));

        var_dump(filter_var($URL, FILTER_VALIDATE_URL,
FILTER_FLAG_SCHEME_REQUIRED | FILTER_FLAG_HOST_REQUIRED));

?>

Expected result:
----------------
return the URL in case it is valid even if it contains '-'

Actual result:
--------------
returns false


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



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

Reply via email to