1--TEST-- 2tls stream wrapper with min version 1.0 and max version 1.1 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 'min_proto_version' => STREAM_CRYPTO_PROTO_TLSv1_0, 15 'max_proto_version' => STREAM_CRYPTO_PROTO_TLSv1_1, 16 ]]); 17 18 $server = stream_socket_server('tls://127.0.0.1:64321', $errno, $errstr, $flags, $ctx); 19 phpt_notify(); 20 21 for ($i=0; $i < (phpt_has_sslv3() ? 6 : 5); $i++) { 22 @stream_socket_accept($server, 3); 23 } 24CODE; 25 26$clientCode = <<<'CODE' 27 $flags = STREAM_CLIENT_CONNECT; 28 $ctx = stream_context_create(['ssl' => [ 29 'verify_peer' => false, 30 'verify_peer_name' => false, 31 ]]); 32 33 phpt_wait(); 34 35 $client = stream_socket_client("tlsv1.0://127.0.0.1:64321", $errno, $errstr, 3, $flags, $ctx); 36 var_dump($client); 37 38 $client = @stream_socket_client("sslv3://127.0.0.1:64321", $errno, $errstr, 3, $flags, $ctx); 39 var_dump($client); 40 41 $client = @stream_socket_client("tlsv1.1://127.0.0.1:64321", $errno, $errstr, 3, $flags, $ctx); 42 var_dump($client); 43 44 $client = @stream_socket_client("tlsv1.2://127.0.0.1:64321", $errno, $errstr, 3, $flags, $ctx); 45 var_dump($client); 46 47 $client = @stream_socket_client("ssl://127.0.0.1:64321", $errno, $errstr, 3, $flags, $ctx); 48 var_dump($client); 49 50 $client = @stream_socket_client("tls://127.0.0.1:64321", $errno, $errstr, 3, $flags, $ctx); 51 var_dump($client); 52CODE; 53 54include 'ServerClientTestCase.inc'; 55ServerClientTestCase::getInstance()->run($clientCode, $serverCode); 56?> 57--EXPECTF-- 58resource(%d) of type (stream) 59bool(false) 60resource(%d) of type (stream) 61bool(false) 62resource(%d) of type (stream) 63resource(%d) of type (stream) 64