PHP  
 PHP_7_1
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Test Failure Report for ext/openssl/tests/bug65538_001.phpt ('Bug #65538: SSL context "cafile" supports stream wrappers')

Script

1: <?php
2: $serverCode 
= <<<'CODE'
3:
    $serverUri = "ssl://127.0.0.1:64321";
4:     $serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN;
5:     $serverCtx = stream_context_create(['ssl' => [
6:         'local_cert' => __DIR__ . '/bug54992.pem',
7:     ]]);
8:
9:     $server = stream_socket_server($serverUri, $errno, $errstr, $serverFlags, $serverCtx);
10:     phpt_notify();
11:
12:     $client = @stream_socket_accept($server);
13:     if ($client) {
14:         $in = '';
15:         while (!preg_match('/\r?\n\r?\n/', $in)) {
16:             $in .= fread($client, 2048);
17:         }
18:         $response = "HTTP/1.0 200 OK\r\n"
19:                   . "Content-Type: text/plain\r\n"
20:                   . "Content-Length: 12\r\n"
21:                   . "Connection: close\r\n"
22:                   . "\r\n"
23:                   . "Hello World!";
24:         fwrite($client, $response);
25:         fclose($client);
26:     }
27:
CODE;
28:
29:
$clientCode = <<<'CODE'
30:
    $serverUri = "https://127.0.0.1:64321/";
31:     $clientCtx = stream_context_create(['ssl' => [
32:         'cafile' => 'file://' . __DIR__ . '/bug54992-ca.pem',
33:         'peer_name' => 'bug54992.local',
34:     ]]);
35:
36:     phpt_wait();
37:     $html = file_get_contents($serverUri, false, $clientCtx);
38:
39:     var_dump($html);
40:
CODE;
41:
42: include 
'ServerClientTestCase.inc';
43:
ServerClientTestCase::getInstance()->run($clientCode$serverCode);
44:
?>
45:

Expected

string(12) "Hello World!"

Output

Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in /var/php_gcov/PHP_7_1/ext/openssl/tests/ServerClientTestCase.inc(96) : eval()'d code on line 8

Warning: file_get_contents(): Failed to enable crypto in /var/php_gcov/PHP_7_1/ext/openssl/tests/ServerClientTestCase.inc(96) : eval()'d code on line 8

Warning: file_get_contents(https://127.0.0.1:64321/): failed to open stream: operation failed in /var/php_gcov/PHP_7_1/ext/openssl/tests/ServerClientTestCase.inc(96) : eval()'d code on line 8
bool(false)

Diff

001+ Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
001- string(12) "Hello World!"
002+ error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in /var/php_gcov/PHP_7_1/ext/openssl/tests/ServerClientTestCase.inc(96) : eval()'d code on line 8
003+ 
004+ Warning: file_get_contents(): Failed to enable crypto in /var/php_gcov/PHP_7_1/ext/openssl/tests/ServerClientTestCase.inc(96) : eval()'d code on line 8
005+ 
006+ Warning: file_get_contents(https://127.0.0.1:64321/): failed to open stream: operation failed in /var/php_gcov/PHP_7_1/ext/openssl/tests/ServerClientTestCase.inc(96) : eval()'d code on line 8
007+ bool(false)

 

Generated at Wed, 01 Dec 2021 02:17:55 +0000 (3 days ago)

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