Req #55212 [Com]: Detect whether IPv6 is enabled with STREAM_PF_INET6
| From: | ivan dot enderlin at hoa-project dot net | Date: | Fri, 15 Jul 2011 17:24:51 +0000 |
| Subject: | Req #55212 [Com]: Detect whether IPv6 is enabled with STREAM_PF_INET6 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-161908@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55212&edit=1
ID: 55212
Comment by: ivan dot enderlin at hoa-project dot net
Reported by: ivan dot enderlin at hoa-project dot net
Summary: Detect whether IPv6 is enabled with STREAM_PF_INET6
Status: Closed
Type: Feature/Change Request
Package: Network related
PHP Version: 5.4SVN-2011-07-15 (SVN)
Assigned To: dsp
Block user comment: N
Private report: N
New Comment:
Credits?
Glad to see the proposition approved and the patch applied.
Previous Comments:
------------------------------------------------------------------------
[2011-07-15 11:26:34] dsp@php.net
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 :/)
------------------------------------------------------------------------
[2011-07-15 11:25:20] dsp@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