Edit report at https://bugs.php.net/bug.php?id=55212&edit=1
ID: 55212 Updated by: d...@php.net Reported by: ivan dot enderlin at hoa-project dot net Summary: Detect whether IPv6 is enabled with STREAM_PF_INET6 -Status: Open +Status: Closed Type: Feature/Change Request Package: Network related PHP Version: 5.4SVN-2011-07-15 (SVN) -Assigned To: +Assigned To: dsp Block user comment: N Private report: N New Comment: This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. I think we should not define STREAM_PF_INET6 in case we have IPv6 disabled. Patch committed (sorry, I forgot to include your credits :/) Previous Comments: ------------------------------------------------------------------------ [2011-07-15 11:25:20] d...@php.net Automatic comment from SVN on behalf of dsp Revision: http://svn.php.net/viewvc/?view=revision&revision=313267 Log: Fix #55212. Only declare STREAM_PF_INET6 if PHP is compiled with IPv6 support ------------------------------------------------------------------------ [2011-07-15 04:40:10] ivan dot enderlin at hoa-project dot net 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 this bug report at https://bugs.php.net/bug.php?id=55212&edit=1