From:             
Operating system: 
PHP version:      5.4SVN-2011-07-15 (SVN)
Package:          Network related
Bug Type:         Feature/Change Request
Bug description:Detect whether IPv6 is enabled with STREAM_PF_INET6

Description:
------------
If PHP has been compiled with the --disable-ipv6 option, the constant
STREAM_PF_INET6 should not exist. It could be useful to detect whether IPv6
has been enabled. To ensure BC, it would be better to set STREAM_PF_INET6
to -1 (or 0, false…).

We could already detect if IPv6 has been disabled with the AF_INET6
constant, declared in ext/sockets/sockets.c with #if HAVE_IPV6, but this
solution is worthless if PHP has been compiled with the --disable-socket
option. We could use IPv6 with stream_* functions, not only with socket_*
functions.

Test script:
---------------
$ php -r "var_dump(defined('STREAM_PF_INET6'), STREAM_PF_INET6);"
$ php -i | grep "IPv6"

Expected result:
----------------
bool(true)
int(-1)
IPv6 Support => disabled

Actual result:
--------------
bool(true)
int(30)
IPv6 Support => disabled

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

Reply via email to