]> granicus.if.org Git - php/commitdiff
MFH: Fix skipif
authorArnaud Le Blanc <lbarnaud@php.net>
Wed, 20 May 2009 09:13:39 +0000 (09:13 +0000)
committerArnaud Le Blanc <lbarnaud@php.net>
Wed, 20 May 2009 09:13:39 +0000 (09:13 +0000)
ext/sockets/tests/ipv6_skipif.inc [new file with mode: 0644]
ext/sockets/tests/ipv6loop.phpt
ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp.phpt

diff --git a/ext/sockets/tests/ipv6_skipif.inc b/ext/sockets/tests/ipv6_skipif.inc
new file mode 100644 (file)
index 0000000..ad8cf77
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+if (!defined("AF_INET6")) {
+       die('skip no IPv6 support');
+}
+/* If IPv6 is supported on the platform this will error out with code 111 - Connection refused.
+   If IPv6 is NOT supported, $errno will be set to something else (indicating parse/getaddrinfo error) */
+@stream_socket_client('tcp://[::1]:0', $errno);
+if ($errno != 111) die('skip no IPv6 support');
index 6fb584045f7cc4b653edfdcd260edb58f199d0bf..6967605ffa2edd61ff51b06b4b1c93dee7de38da 100644 (file)
@@ -5,9 +5,7 @@ IPv6 Loopback test
        if (!extension_loaded('sockets')) {
                die('skip sockets extension not available.');
        }
-       if (!defined("AF_INET6")) {
-               die('skip no IPv6 support');
-       }
+       require 'ipv6_skipif.inc';
 ?>
 --FILE--
 <?php
index 5b8b742f3f420aa692ad35b7aed324fa9da29071..1fa42fd5da4d8b0b4c6ffa2d84fe9b785543da65 100644 (file)
@@ -5,6 +5,7 @@ Test if socket_recvfrom() receives data sent by socket_sendto() via IPv6 UDP
 if (!extension_loaded('sockets')) {
     die('SKIP The sockets extension is not loaded.');
 }
+require 'ipv6_skipif.inc';
 --FILE--
 <?php
     $socket = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP);