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/stream_verify_peer_name_003.phpt ('Host name mismatch triggers error')

Script

1: <?php
2: $certFile 
__DIR__ DIRECTORY_SEPARATOR 'stream_verify_peer_name_003.pem.tmp';
3:
$cacertFile __DIR__ DIRECTORY_SEPARATOR 'stream_verify_peer_name_003-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:
$actualPeerName 'stream_verify_peer_name_003';
20:
$clientCode = <<<'CODE'
21:
    $serverUri = "ssl://127.0.0.1:64321";
22:     $clientFlags = STREAM_CLIENT_CONNECT;
23:     $clientCtx = stream_context_create(['ssl' => [
24:         'verify_peer' => true,
25:         'cafile' => '%s'
26:     ]]);
27:
28:     phpt_wait();
29:     $client = stream_socket_client($serverUri, $errno, $errstr, 1, $clientFlags, $clientCtx);
30:
31:     var_dump($client);
32:
CODE;
33:
$clientCode sprintf($clientCode$cacertFile);
34:
35: include 
'CertificateGenerator.inc';
36:
$certificateGenerator = new CertificateGenerator();
37:
$certificateGenerator->saveCaCert($cacertFile);
38:
$certificateGenerator->saveNewCertAsFileWithKey($actualPeerName$certFile);
39:
40: include 
'ServerClientTestCase.inc';
41:
ServerClientTestCase::getInstance()->run($clientCode$serverCode);
42:
?>
43:

Expected

Warning: stream_socket_client(): Peer certificate CN=`stream_verify_peer_name_003' did not match expected CN=`127.0.0.1' in %s on line %d

Warning: stream_socket_client(): Failed to enable crypto in %s on line %d

Warning: stream_socket_client(): unable to connect to ssl://127.0.0.1:64321 (Unknown error) in %s on line %d
bool(false)

Output

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

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

Warning: stream_socket_client(): unable to connect to ssl://127.0.0.1:64321 (Unknown error) in /var/php_gcov/PHP_HEAD/ext/openssl/tests/ServerClientTestCase.inc(130) : eval()'d code on line 9
bool(false)

Diff

001+ Warning: stream_socket_client(): SSL: Handshake timed out in /var/php_gcov/PHP_HEAD/ext/openssl/tests/ServerClientTestCase.inc(130) : eval()'d code on line 9
001- Warning: stream_socket_client(): Peer certificate CN=`stream_verify_peer_name_003' did not match expected CN=`127.0.0.1' in %s on line %d

 

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

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