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?>
8--FILE--
9<?php
10$serverCode = <<<'CODE'
11    $serverUri = "ssl://127.0.0.1:64321";
12    $serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN;
13    $serverCtx = stream_context_create(['ssl' => [
14        'local_cert' => __DIR__ . '/bug54992.pem'
15    ]]);
16
17    $server = stream_socket_server($serverUri, $errno, $errstr, $serverFlags, $serverCtx);
18    phpt_notify();
19
20    @stream_socket_accept($server, 1);
21CODE;
22
23$clientCode = <<<'CODE'
24    $serverUri = "ssl://127.0.0.1:64321";
25    $clientFlags = STREAM_CLIENT_CONNECT;
26    $clientCtx = stream_context_create(['ssl' => [
27        'verify_peer' => true,
28        'cafile' => __DIR__ . '/bug54992-ca.pem',
29        'verify_peer_name' => false
30    ]]);
31
32    phpt_wait();
33    $client = stream_socket_client($serverUri, $errno, $errstr, 2, $clientFlags, $clientCtx);
34
35    var_dump($client);
36CODE;
37
38include 'ServerClientTestCase.inc';
39ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
40?>
41--EXPECTF--
42resource(%d) of type (stream)
43