1--TEST-- 2Bug #76705: unusable ssl => peer_fingerprint in stream_context_create() 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 $serverUri = "ssl://127.0.0.1:64323"; 12 $serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN; 13 $serverCtx = stream_context_create(['ssl' => [ 14 'local_cert' => __DIR__ . '/bug76705.pem' 15 ]]); 16 17 $server = stream_socket_server($serverUri, $errno, $errstr, $serverFlags, $serverCtx); 18 phpt_notify(); 19 20 @stream_socket_accept($server, 1); 21CODE; 22 23$clientCode = <<<'CODE' 24 $serverUri = "ssl://127.0.0.1:64323"; 25 $clientFlags = STREAM_CLIENT_CONNECT; 26 $clientCtx = stream_context_create(['ssl' => [ 27 'verify_peer' => true, 28 'peer_name' => 'openssl.php.net', 29 'allow_self_signed' => true, 30 'peer_fingerprint' => [ 31 'sha256' => '4A524F3617E41BCCA1370ED9E89C9A7A83C28F0F342C490296D362869BDF1DA8', 32 ] 33 ]]); 34 35 phpt_wait(); 36 var_dump(stream_socket_client($serverUri, $errno, $errstr, 2, $clientFlags, $clientCtx)); 37CODE; 38 39include 'ServerClientTestCase.inc'; 40ServerClientTestCase::getInstance()->run($clientCode, $serverCode); 41?> 42--EXPECTF-- 43resource(%d) of type (stream) 44