1--TEST-- 2Basic bitwise stream crypto context flag assignment 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 $serverUri = "ssl://127.0.0.1:64321"; 11 $serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN; 12 $serverCtx = stream_context_create(['ssl' => [ 13 'local_cert' => __DIR__ . '/bug54992.pem' 14 ]]); 15 16 $server = stream_socket_server($serverUri, $errno, $errstr, $serverFlags, $serverCtx); 17 phpt_notify(); 18 19 @stream_socket_accept($server, 1); 20 @stream_socket_accept($server, 1); 21 @stream_socket_accept($server, 1); 22CODE; 23 24$clientCode = <<<'CODE' 25 $serverUri = "ssl://127.0.0.1:64321"; 26 $clientFlags = STREAM_CLIENT_CONNECT; 27 $clientCtx = stream_context_create(['ssl' => [ 28 'verify_peer' => true, 29 'cafile' => __DIR__ . '/bug54992-ca.pem', 30 'peer_name' => 'bug54992.local', 31 ]]); 32 33 phpt_wait(); 34 35 stream_context_set_option($clientCtx, 'ssl', 'crypto_method', STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT); 36 var_dump(stream_socket_client($serverUri, $errno, $errstr, 1, $clientFlags, $clientCtx)); 37 38 stream_context_set_option($clientCtx, 'ssl', 'crypto_method', STREAM_CRYPTO_METHOD_TLS_CLIENT); 39 var_dump(stream_socket_client($serverUri, $errno, $errstr, 1, $clientFlags, $clientCtx)); 40CODE; 41 42include 'ServerClientTestCase.inc'; 43ServerClientTestCase::getInstance()->run($clientCode, $serverCode); 44--EXPECTF-- 45resource(%d) of type (stream) 46resource(%d) of type (stream) 47