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/bug46127.phpt ('#46127 php_openssl_tcp_sockop_accept forgets to set context on accepted stream')

Script

1: <?php
2: $certFile 
__DIR__ DIRECTORY_SEPARATOR 'bug46127.pem.tmp';
3:
4:
$serverCode = <<<'CODE'
5:
    $serverUri = "ssl://127.0.0.1:64321";
6:     $serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN;
7:     $serverCtx = stream_context_create(['ssl' => [
8:         'local_cert' => '%s',
9:     ]]);
10:
11:     $sock = stream_socket_server($serverUri, $errno, $errstr, $serverFlags, $serverCtx);
12:     phpt_notify();
13:
14:     $link = stream_socket_accept($sock);
15:     fwrite($link, "Sending bug 46127\n");
16:
CODE;
17:
$serverCode sprintf($serverCode$certFile);
18:
19:
$clientCode = <<<'CODE'
20:
    $serverUri = "ssl://127.0.0.1:64321";
21:     $clientFlags = STREAM_CLIENT_CONNECT;
22:
23:     $clientCtx = stream_context_create(['ssl' => [
24:         'verify_peer' => false,
25:         'verify_peer_name' => false
26:     ]]);
27:
28:     phpt_wait();
29:     $sock = stream_socket_client($serverUri, $errno, $errstr, 2, $clientFlags, $clientCtx);
30:
31:     echo fgets($sock);
32:
CODE;
33:
34: include 
'CertificateGenerator.inc';
35:
$certificateGenerator = new CertificateGenerator();
36:
$certificateGenerator->saveNewCertAsFileWithKey('bug46127'$certFile);
37:
38: include 
'ServerClientTestCase.inc';
39:
ServerClientTestCase::getInstance()->run($clientCode$serverCode);
40:
?>
41:

Expected

Sending bug 46127

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 10

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 10

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(96) : eval()'d code on line 10

Warning: fgets() expects parameter 1 to be resource, bool given in /var/php_gcov/PHP_HEAD/ext/openssl/tests/ServerClientTestCase.inc(96) : eval()'d code on line 12

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 10
001- Sending bug 46127
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 10
004+ 
005+ 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(96) : eval()'d code on line 10
006+ 
007+ Warning: fgets() expects parameter 1 to be resource, bool given in /var/php_gcov/PHP_HEAD/ext/openssl/tests/ServerClientTestCase.inc(96) : eval()'d code on line 12

 

Generated at Mon, 14 Jan 2019 03:56:25 +0000 (4 days ago)

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