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