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/stream_crypto_flags_004.phpt ('Specific protocol method specification')

Script

1: <?php
2: $certFile 
__DIR__ DIRECTORY_SEPARATOR 'stream_crypto_flags_004.pem.tmp';
3:
$cacertFile __DIR__ DIRECTORY_SEPARATOR 'stream_crypto_flags_004-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:         'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_0_SERVER,
11:     ]]);
12:
13:     $server = stream_socket_server($serverUri, $errno, $errstr, $serverFlags, $serverCtx);
14:     phpt_notify();
15:
16:     @stream_socket_accept($server, 1);
17:     @stream_socket_accept($server, 1);
18:     @stream_socket_accept($server, 1);
19:     @stream_socket_accept($server, 1);
20:
CODE;
21:
$serverCode sprintf($serverCode$certFile);
22:
23:
$peerName 'stream_crypto_flags_004';
24:
$clientCode = <<<'CODE'
25:
    $serverUri = "ssl://127.0.0.1:64321";
26:     $clientFlags = STREAM_CLIENT_CONNECT;
27:     $clientCtx = stream_context_create(['ssl' => [
28:         'verify_peer' => true,
29:         'cafile' => '%s',
30:         'peer_name' => '%s',
31:     ]]);
32:
33:     phpt_wait();
34:
35:     // Should succeed because the SSLv23 handshake here is compatible with the
36:     // TLSv1 hello method employed in the server
37:     var_dump(@stream_socket_client($serverUri, $errno, $errstr, 1, $clientFlags, $clientCtx));
38:
39:     // Should fail because the TLSv1.1 hello method is not supported
40:     stream_context_set_option($clientCtx, 'ssl', 'crypto_method', STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT);
41:     var_dump(@stream_socket_client($serverUri, $errno, $errstr, 1, $clientFlags, $clientCtx));
42:
43:     // Should fail because the TLSv1.2 hello method is not supported
44:     stream_context_set_option($clientCtx, 'ssl', 'crypto_method', STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT);
45:     var_dump(@stream_socket_client($serverUri, $errno, $errstr, 1, $clientFlags, $clientCtx));
46:
47:     // Should succeed because we use the same TLSv1 hello
48:     stream_context_set_option($clientCtx, 'ssl', 'crypto_method', STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT);
49:     var_dump(stream_socket_client($serverUri, $errno, $errstr, 1, $clientFlags, $clientCtx));
50:
CODE;
51:
$clientCode sprintf($clientCode$cacertFile$peerName);
52:
53: include 
'CertificateGenerator.inc';
54:
$certificateGenerator = new CertificateGenerator();
55:
$certificateGenerator->saveCaCert($cacertFile);
56:
$certificateGenerator->saveNewCertAsFileWithKey($peerName$certFile);
57:
58: include 
'ServerClientTestCase.inc';
59:
ServerClientTestCase::getInstance()->run($clientCode$serverCode);
60:
?>
61:

Expected

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

Output

bool(false)
bool(false)
bool(false)

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

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

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(130) : eval()'d code on line 25
bool(false)

Diff

001+ bool(false)
001- resource(%d) of type (stream)
004+ 
004- resource(%d) of type (stream)
005+ Warning: stream_socket_client(): SSL: Handshake timed out in /var/php_gcov/PHP_7_2/ext/openssl/tests/ServerClientTestCase.inc(130) : eval()'d code on line 25
006+ 
007+ Warning: stream_socket_client(): Failed to enable crypto in /var/php_gcov/PHP_7_2/ext/openssl/tests/ServerClientTestCase.inc(130) : eval()'d code on line 25
008+ 
009+ 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(130) : eval()'d code on line 25
010+ bool(false)

 

Generated at Wed, 13 Mar 2019 11:02:43 +0000 (5 days ago)

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