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/capture_peer_cert_001.phpt ('capture_peer_cert context captures on verify failure')

Script

1: <?php
2: $certFile 
__DIR__ DIRECTORY_SEPARATOR 'capture_peer_cert_001.pem.tmp';
3:
$cacertFile __DIR__ DIRECTORY_SEPARATOR 'capture_peer_cert_001-ca.pem.tmp';
4:
5:
$serverCode = <<<'CODE'
6:
    $serverUri = "ssl://127.0.0.1:64321";
7:     $serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN;
8:     $serverCtx = stream_context_create(['ssl' => [
9:         'local_cert' => '%s'
10:     ]]);
11:
12:     $server = stream_socket_server($serverUri, $errno, $errstr, $serverFlags, $serverCtx);
13:     phpt_notify();
14:
15:     @stream_socket_accept($server, 1);
16:
CODE;
17:
$serverCode sprintf($serverCode$certFile);
18:
19:
$peerName 'capture_peer_cert_001';
20:
$clientCode = <<<'CODE'
21:
    $serverUri = "ssl://127.0.0.1:64321";
22:     $clientFlags = STREAM_CLIENT_CONNECT;
23:     $clientCtx = stream_context_create(['ssl' => [
24:         'capture_peer_cert' => true,
25:         'cafile' => '%s'
26:     ]]);
27:
28:     phpt_wait();
29:     $client = @stream_socket_client($serverUri, $errno, $errstr, 1, $clientFlags, $clientCtx);
30:     $cert = stream_context_get_options($clientCtx)['ssl']['peer_certificate'];
31:     var_dump(openssl_x509_parse($cert)['subject']['CN']);
32:
CODE;
33:
$clientCode sprintf($clientCode$cacertFile);
34:
35: include 
'CertificateGenerator.inc';
36:
$certificateGenerator = new CertificateGenerator();
37:
$certificateGenerator->saveCaCert($cacertFile);
38:
$certificateGenerator->saveNewCertAsFileWithKey($peerName$certFile);
39:
40: include 
'ServerClientTestCase.inc';
41:
ServerClientTestCase::getInstance()->run($clientCode$serverCode);
42:
?>
43:

Expected

string(%d) "capture_peer_cert_001"

Output

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

Diff

001+ Notice: Undefined index: peer_certificate in /var/php_gcov/PHP_HEAD/ext/openssl/tests/ServerClientTestCase.inc(130) : eval()'d code on line 10
001- string(%d) "capture_peer_cert_001"
002+ NULL

 

Generated at Tue, 19 Mar 2019 00:18:08 +0000 (4 days ago)

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