PHP  
 PHP_7_2
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Test Failure Report for ext/openssl/tests/sni_server_key_cert.phpt ('sni_server with separate pk and cert')

Script

1: <?php
2: $serverCode 
= <<<'CODE'
3:
    $flags = STREAM_SERVER_BIND|STREAM_SERVER_LISTEN;
4:     $ctx = stream_context_create(['ssl' => [
5:         'local_cert' => __DIR__ . '/domain1.pem',
6:         'SNI_server_certs' => [
7:             "domain1.com" => [
8:                 'local_cert' => __DIR__ . "/sni_server_domain1_cert.pem",
9:                 'local_pk' => __DIR__ . "/sni_server_domain1_key.pem"
10:             ],
11:             "domain2.com" => [
12:                 'local_cert' => __DIR__ . "/sni_server_domain2_cert.pem",
13:                 'local_pk' => __DIR__ . "/sni_server_domain2_key.pem"
14:             ],
15:             "domain3.com" => [
16:                 'local_cert' => __DIR__ . "/sni_server_domain3_cert.pem",
17:                 'local_pk' => __DIR__ . "/sni_server_domain3_key.pem"
18:             ],
19:         ]
20:     ]]);
21:
22:     $server = stream_socket_server('tls://127.0.0.1:64321', $errno, $errstr, $flags, $ctx);
23:     phpt_notify();
24:
25:     for ($i=0; $i < 3; $i++) {
26:         @stream_socket_accept($server, 3);
27:     }
28:
CODE;
29:
30:
$clientCode = <<<'CODE'
31:
    $flags = STREAM_CLIENT_CONNECT;
32:     $ctxArr = [
33:         'cafile' => __DIR__ . '/sni_server_ca.pem',
34:         'capture_peer_cert' => true
35:     ];
36:
37:     phpt_wait();
38:
39:     $ctxArr['peer_name'] = 'domain1.com';
40:     $ctx = stream_context_create(['ssl' => $ctxArr]);
41:     $client = stream_socket_client("tls://127.0.0.1:64321", $errno, $errstr, 1, $flags, $ctx);
42:     $cert = stream_context_get_options($ctx)['ssl']['peer_certificate'];
43:     var_dump(openssl_x509_parse($cert)['subject']['CN']);
44:
45:     $ctxArr['peer_name'] = 'domain2.com';
46:     $ctx = stream_context_create(['ssl' => $ctxArr]);
47:     $client = @stream_socket_client("tls://127.0.0.1:64321", $errno, $errstr, 1, $flags, $ctx);
48:     $cert = stream_context_get_options($ctx)['ssl']['peer_certificate'];
49:     var_dump(openssl_x509_parse($cert)['subject']['CN']);
50:
51:     $ctxArr['peer_name'] = 'domain3.com';
52:     $ctx = stream_context_create(['ssl' => $ctxArr]);
53:     $client = @stream_socket_client("tls://127.0.0.1:64321", $errno, $errstr, 1, $flags, $ctx);
54:     $cert = stream_context_get_options($ctx)['ssl']['peer_certificate'];
55:     var_dump(openssl_x509_parse($cert)['subject']['CN']);
56:
CODE;
57:
58: include 
'ServerClientTestCase.inc';
59:
ServerClientTestCase::getInstance()->run($clientCode$serverCode);
60:

Expected

string(%d) "domain1.com"
string(%d) "domain2.com"
string(%d) "domain3.com"

Output

Warning: stream_socket_client(): SSL: Handshake timed out in /var/php_gcov/PHP_7_2/ext/openssl/tests/ServerClientTestCase.inc(96) : eval()'d code on line 11

Warning: stream_socket_client(): Failed to enable crypto in /var/php_gcov/PHP_7_2/ext/openssl/tests/ServerClientTestCase.inc(96) : eval()'d code on line 11

Warning: stream_socket_client(): unable to connect to tls://127.0.0.1:64321 (Unknown error) in /var/php_gcov/PHP_7_2/ext/openssl/tests/ServerClientTestCase.inc(96) : eval()'d code on line 11

Notice: Undefined index: peer_certificate in /var/php_gcov/PHP_7_2/ext/openssl/tests/ServerClientTestCase.inc(96) : eval()'d code on line 12
NULL

Notice: Undefined index: peer_certificate in /var/php_gcov/PHP_7_2/ext/openssl/tests/ServerClientTestCase.inc(96) : eval()'d code on line 18
NULL

Notice: Undefined index: peer_certificate in /var/php_gcov/PHP_7_2/ext/openssl/tests/ServerClientTestCase.inc(96) : eval()'d code on line 24
NULL

Diff

001+ Warning: stream_socket_client(): SSL: Handshake timed out in /var/php_gcov/PHP_7_2/ext/openssl/tests/ServerClientTestCase.inc(96) : eval()'d code on line 11
002+ 
003+ Warning: stream_socket_client(): Failed to enable crypto in /var/php_gcov/PHP_7_2/ext/openssl/tests/ServerClientTestCase.inc(96) : eval()'d code on line 11
001- string(%d) "domain1.com"
002- string(%d) "domain2.com"
003- string(%d) "domain3.com"
004+ 
005+ Warning: stream_socket_client(): unable to connect to tls://127.0.0.1:64321 (Unknown error) in /var/php_gcov/PHP_7_2/ext/openssl/tests/ServerClientTestCase.inc(96) : eval()'d code on line 11
006+ 
007+ Notice: Undefined index: peer_certificate in /var/php_gcov/PHP_7_2/ext/openssl/tests/ServerClientTestCase.inc(96) : eval()'d code on line 12
008+ NULL
009+ 
010+ Notice: Undefined index: peer_certificate in /var/php_gcov/PHP_7_2/ext/openssl/tests/ServerClientTestCase.inc(96) : eval()'d code on line 18
011+ NULL
012+ 
013+ Notice: Undefined index: peer_certificate in /var/php_gcov/PHP_7_2/ext/openssl/tests/ServerClientTestCase.inc(96) : eval()'d code on line 24
014+ NULL

 

Generated at Tue, 21 Nov 2017 01:17:01 +0000 (5 hours ago)

Copyright © 2005-2017 The PHP Group
All rights reserved.