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