1--TEST--
2tlsv1.0 stream wrapper
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    $flags = STREAM_SERVER_BIND|STREAM_SERVER_LISTEN;
11    $ctx = stream_context_create(['ssl' => [
12        'local_cert' => __DIR__ . '/streams_crypto_method.pem',
13    ]]);
14
15    $server = stream_socket_server('tlsv1.0://127.0.0.1:64321', $errno, $errstr, $flags, $ctx);
16    phpt_notify();
17
18    for ($i=0; $i < 3; $i++) {
19        @stream_socket_accept($server, 3);
20    }
21CODE;
22
23$clientCode = <<<'CODE'
24    $flags = STREAM_CLIENT_CONNECT;
25    $ctx = stream_context_create(['ssl' => [
26        'verify_peer' => false,
27        'verify_peer_name' => false,
28    ]]);
29
30    phpt_wait();
31
32    $client = stream_socket_client("tlsv1.0://127.0.0.1:64321", $errno, $errstr, 3, $flags, $ctx);
33    var_dump($client);
34
35    $client = @stream_socket_client("sslv3://127.0.0.1:64321", $errno, $errstr, 3, $flags, $ctx);
36    var_dump($client);
37
38    $client = @stream_socket_client("tlsv1.2://127.0.0.1:64321", $errno, $errstr, 3, $flags, $ctx);
39    var_dump($client);
40CODE;
41
42include 'ServerClientTestCase.inc';
43ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
44--EXPECTF--
45resource(%d) of type (stream)
46bool(false)
47bool(false)
48