Skip to content

Commit d445ec5

Browse files
committed
Skip test if IPv6 support is not available
Use different port number (possible re-use failure in tests)
1 parent d297059 commit d445ec5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

ext/openssl/tests/san_ipv6_peer_matching.phpt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,18 @@ openssl
55
--SKIPIF--
66
<?php
77
if (!function_exists("proc_open")) die("skip no proc_open");
8+
$packed = str_repeat(chr(0), 15) . chr(1);
9+
if (@inet_ntop($packed) === false) {
10+
die("skip no IPv6 support");
11+
}
812
?>
913
--FILE--
1014
<?php
1115
$certFile = __DIR__ . DIRECTORY_SEPARATOR . 'san_ipv6_peer_matching.pem.tmp';
1216
$san = 'IP:2001:db8:85a3:8d3:1319:8a2e:370:7348';
1317

1418
$serverCode = <<<'CODE'
15-
$serverUri = "ssl://[::1]:64321";
19+
$serverUri = "ssl://[::1]:64324";
1620
$serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN;
1721
$serverCtx = stream_context_create(['ssl' => [
1822
'local_cert' => '%s',
@@ -27,7 +31,7 @@ CODE;
2731
$serverCode = sprintf($serverCode, $certFile);
2832

2933
$clientCode = <<<'CODE'
30-
$serverUri = "ssl://[::1]:64321";
34+
$serverUri = "ssl://[::1]:64324";
3135
$clientFlags = STREAM_CLIENT_CONNECT;
3236
$clientCtx = stream_context_create(['ssl' => [
3337
'verify_peer' => false,
@@ -60,5 +64,5 @@ Warning: stream_socket_client(): Unable to locate peer certificate CN in %s on l
6064

6165
Warning: stream_socket_client(): Failed to enable crypto in %s on line %d
6266

63-
Warning: stream_socket_client(): Unable to connect to ssl://[::1]:64321 (Unknown error) in %s on line %d
67+
Warning: stream_socket_client(): Unable to connect to ssl://[::1]:64324 (Unknown error) in %s on line %d
6468
bool(false)

0 commit comments

Comments
 (0)