1--TEST--
2Allow host name mismatch when "verify_host" disabled
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' => true,
27        'cafile' => __DIR__ . '/bug54992-ca.pem',
28        'verify_peer_name' => false
29    ]]);
30
31    phpt_wait();
32    $client = stream_socket_client($serverUri, $errno, $errstr, 2, $clientFlags, $clientCtx);
33
34    var_dump($client);
35CODE;
36
37include 'ServerClientTestCase.inc';
38ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
39--EXPECTF--
40resource(%d) of type (stream)
41