From:             
Operating system: Linux
PHP version:      5.3.5
Package:          Filter related
Bug Type:         Bug
Bug description:FILTER_VALIDATE_URL does not allow - in domain name

Description:
------------
FILTER_VALIDATE_URL documentatin says that it does filtering according to 
rfc2396, but in fact filter_var fails to conform RFC.



Hostname definition in rfc is as follows:



hostport      = host [ ":" port ]

host          = hostname | IPv4address

hostname      = *( domainlabel "." ) toplabel [ "." ]

domainlabel   = alphanum | alphanum *( alphanum | "-" ) alphanum

toplabel      = alpha | alpha *( alphanum | "-" ) alphanum





so it should allow "-" dash symbol in domainnames (both domain name and TLD
name).



In other hand it SHOULD NOT allow "_" symbol in the domain name, as it is
against specification (right now it allows).

 

Test script:
---------------
first case also should validate successfully  



php -r 'var_dump(filter_var("http://ea-sd.com";, FILTER_VALIDATE_URL));'

bool(false)



php -r 'var_dump(filter_var("http://easd.com";, FILTER_VALIDATE_URL));'

string(15) "http://easd.com";






-- 
Edit bug report at http://bugs.php.net/bug.php?id=54255&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=54255&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=54255&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=54255&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=54255&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=54255&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=54255&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=54255&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=54255&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=54255&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=54255&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=54255&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=54255&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=54255&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=54255&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=54255&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=54255&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=54255&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=54255&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=54255&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=54255&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=54255&r=mysqlcfg

Reply via email to