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/peer_verification.phpt ('Peer verification enabled for client streams')

Script

1: <?php
2: $certFile 
__DIR__ DIRECTORY_SEPARATOR 'peer_verification.pem.tmp';
3:
$cacertFile __DIR__ DIRECTORY_SEPARATOR 'peer_verification-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:     for ($i = 0; $i < 5; $i++) {
16:         @stream_socket_accept($server, 1);
17:     }
18:
CODE;
19:
$serverCode sprintf($serverCode$certFile);
20:
21:
$peerName 'peer_verification';
22:
$clientCode = <<<'CODE'
23:
    $serverUri = "ssl://127.0.0.1:64321";
24:     $clientFlags = STREAM_CLIENT_CONNECT;
25:     $caFile = '%s';
26:
27:     phpt_wait();
28:
29:     // Expected to fail -- untrusted server cert and no CA File present
30:     var_dump(@stream_socket_client($serverUri, $errno, $errstr, 1, $clientFlags));
31:
32:     // Expected to fail -- untrusted server cert and no CA File present
33:     $clientCtx = stream_context_create(['ssl' => [
34:         'verify_peer' => true,
35:     ]]);
36:     var_dump(@stream_socket_client($serverUri, $errno, $errstr, 1, $clientFlags, $clientCtx));
37:
38:     // Should succeed with peer verification disabled in context
39:     $clientCtx = stream_context_create(['ssl' => [
40:         'verify_peer' => false,
41:         'verify_peer_name' => false,
42:     ]]);
43:     var_dump(stream_socket_client($serverUri, $errno, $errstr, 1, $clientFlags, $clientCtx));
44:
45:     // Should succeed with CA file specified in context
46:     $clientCtx = stream_context_create(['ssl' => [
47:         'cafile'   => $caFile,
48:         'peer_name' => '%s',
49:     ]]);
50:     var_dump(stream_socket_client($serverUri, $errno, $errstr, 1, $clientFlags, $clientCtx));
51:
CODE;
52:
$clientCode sprintf($clientCode$cacertFile$peerName);
53:
54: include 
'CertificateGenerator.inc';
55:
$certificateGenerator = new CertificateGenerator();
56:
$certificateGenerator->saveCaCert($cacertFile);
57:
$certificateGenerator->saveNewCertAsFileWithKey($peerName$certFile);
58:
59: include 
'ServerClientTestCase.inc';
60:
ServerClientTestCase::getInstance()->run($clientCode$serverCode);
61:
?>
62:

Expected

bool(false)
bool(false)
resource(%d) of type (stream)
resource(%d) of type (stream)

Output

bool(false)
bool(false)

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

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

Warning: stream_socket_client(): unable to connect to ssl://127.0.0.1:64321 (Unknown error) in /var/php_gcov/PHP_7_2/ext/openssl/tests/ServerClientTestCase.inc(118) : eval()'d code on line 21
bool(false)
resource(23) of type (stream)

Diff

003+ 
004+ Warning: stream_socket_client(): SSL: Handshake timed out in /var/php_gcov/PHP_7_2/ext/openssl/tests/ServerClientTestCase.inc(118) : eval()'d code on line 21
005+ 
006+ Warning: stream_socket_client(): Failed to enable crypto in /var/php_gcov/PHP_7_2/ext/openssl/tests/ServerClientTestCase.inc(118) : eval()'d code on line 21
007+ 
008+ Warning: stream_socket_client(): unable to connect to ssl://127.0.0.1:64321 (Unknown error) in /var/php_gcov/PHP_7_2/ext/openssl/tests/ServerClientTestCase.inc(118) : eval()'d code on line 21
009+ bool(false)
004- resource(%d) of type (stream)

 

Generated at Sun, 10 Feb 2019 05:24:25 +0000 (10 days ago)

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