PHP  
 PHP_HEAD
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:             "cs.php.net" => [
8:                 'local_cert' => __DIR__ . "/sni_server_cs_cert.pem",
9:                 'local_pk' => __DIR__ . "/sni_server_cs_key.pem"
10:             ],
11:             "uk.php.net" => [
12:                 'local_cert' => __DIR__ . "/sni_server_uk_cert.pem",
13:                 'local_pk' => __DIR__ . "/sni_server_uk_key.pem"
14:             ],
15:             "us.php.net" => [
16:                 'local_cert' => __DIR__ . "/sni_server_us_cert.pem",
17:                 'local_pk' => __DIR__ . "/sni_server_us_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'] = 'cs.php.net';
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'] = 'uk.php.net';
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'] = 'us.php.net';
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:
?>
61:

Expected

string(%d) "cs.php.net"
string(%d) "uk.php.net"
string(%d) "us.php.net"

Output

Warning: stream_socket_client(): SSL: Handshake timed out in /var/php_gcov/PHP_HEAD/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_HEAD/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_HEAD/ext/openssl/tests/ServerClientTestCase.inc(96) : eval()'d code on line 11

Notice: Undefined index: peer_certificate in /var/php_gcov/PHP_HEAD/ext/openssl/tests/ServerClientTestCase.inc(96) : eval()'d code on line 12
NULL
string(10) "uk.php.net"
string(10) "us.php.net"

Diff

001+ Warning: stream_socket_client(): SSL: Handshake timed out in /var/php_gcov/PHP_HEAD/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_HEAD/ext/openssl/tests/ServerClientTestCase.inc(96) : eval()'d code on line 11
004+ 
005+ Warning: stream_socket_client(): unable to connect to tls://127.0.0.1:64321 (Unknown error) in /var/php_gcov/PHP_HEAD/ext/openssl/tests/ServerClientTestCase.inc(96) : eval()'d code on line 11
006+ 
007+ Notice: Undefined index: peer_certificate in /var/php_gcov/PHP_HEAD/ext/openssl/tests/ServerClientTestCase.inc(96) : eval()'d code on line 12
008+ NULL
001- string(%d) "cs.php.net"

 

Generated at Wed, 17 Oct 2018 05:34:51 +0000 (4 days ago)

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