1--TEST--
2Verify host name by default in client transfers
3--SKIPIF--
4<?php
5if (!extension_loaded("openssl")) die("skip openssl not loaded");
6if (!function_exists("proc_open")) die("skip no proc_open");
7--FILE--
8<?php
9$serverCode = <<<'CODE'
10    $serverUri = "ssl://127.0.0.1:64321";
11    $serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN;
12    $serverCtx = stream_context_create(['ssl' => [
13        'local_cert' => __DIR__ . '/bug54992.pem'
14    ]]);
15
16    $server = stream_socket_server($serverUri, $errno, $errstr, $serverFlags, $serverCtx);
17    phpt_notify();
18
19    @stream_socket_accept($server, 1);
20CODE;
21
22$clientCode = <<<'CODE'
23    $serverUri = "ssl://127.0.0.1:64321";
24    $clientFlags = STREAM_CLIENT_CONNECT;
25    $clientCtx = stream_context_create(['ssl' => [
26        'verify_peer' => false,
27        'peer_name' => 'bug54992.local'
28    ]]);
29
30    phpt_wait();
31    $client = stream_socket_client($serverUri, $errno, $errstr, 1, $clientFlags, $clientCtx);
32
33    var_dump($client);
34CODE;
35
36include 'ServerClientTestCase.inc';
37ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
38--EXPECTF--
39resource(%d) of type (stream)
40