1--TEST--
2tlsv1.0 stream wrapper
3--EXTENSIONS--
4openssl
5--SKIPIF--
6<?php
7if (!function_exists("proc_open")) die("skip no proc_open");
8?>
9--FILE--
10<?php
11$certFile = __DIR__ . DIRECTORY_SEPARATOR . 'tlsv1.0_wrapper.pem.tmp';
12
13$serverCode = <<<'CODE'
14    $flags = STREAM_SERVER_BIND|STREAM_SERVER_LISTEN;
15    $ctx = stream_context_create(['ssl' => [
16        'local_cert' => '%s',
17        'security_level' => 0,
18    ]]);
19
20    $server = stream_socket_server('tlsv1.0://127.0.0.1:64321', $errno, $errstr, $flags, $ctx);
21    phpt_notify();
22
23    for ($i = 0; $i < (phpt_has_sslv3() ? 3 : 2); $i++) {
24        @stream_socket_accept($server, 3);
25    }
26CODE;
27$serverCode = sprintf($serverCode, $certFile);
28
29$clientCode = <<<'CODE'
30    $flags = STREAM_CLIENT_CONNECT;
31    $ctx = stream_context_create(['ssl' => [
32        'verify_peer' => false,
33        'verify_peer_name' => false,
34        'security_level' => 0,
35    ]]);
36
37    phpt_wait();
38
39    $client = stream_socket_client("tlsv1.0://127.0.0.1:64321", $errno, $errstr, 3, $flags, $ctx);
40    var_dump($client);
41
42    $client = @stream_socket_client("sslv3://127.0.0.1:64321", $errno, $errstr, 3, $flags, $ctx);
43    var_dump($client);
44
45    $client = @stream_socket_client("tlsv1.2://127.0.0.1:64321", $errno, $errstr, 3, $flags, $ctx);
46    var_dump($client);
47CODE;
48
49include 'CertificateGenerator.inc';
50$certificateGenerator = new CertificateGenerator();
51$certificateGenerator->saveNewCertAsFileWithKey('tlsv1.0_wrapper', $certFile);
52
53include 'ServerClientTestCase.inc';
54ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
55?>
56--CLEAN--
57<?php
58@unlink(__DIR__ . DIRECTORY_SEPARATOR . 'tlsv1.0_wrapper.pem.tmp');
59?>
60--EXPECTF--
61resource(%d) of type (stream)
62bool(false)
63bool(false)
64