-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Expand file tree
/
Copy pathgh19245.phpt
More file actions
53 lines (44 loc) · 1.69 KB
/
Copy pathgh19245.phpt
File metadata and controls
53 lines (44 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
--TEST--
GH-19245: Success error message on TLS stream accept failure
--EXTENSIONS--
openssl
--SKIPIF--
<?php
if (!function_exists("proc_open")) die("skip no proc_open");
?>
--FILE--
<?php
include 'ServerClientTestCase.inc';
$baseDir = __DIR__ . '/gh19245';
$baseDirCertFile = $baseDir . '/cert.crt';
$baseDirPkFile = $baseDir . '/private.key';
$serverCodeTemplate = <<<'CODE'
ini_set('log_errors', 'On');
ini_set('open_basedir', __DIR__ . '/gh19245');
$serverUri = "ssl://127.0.0.1:0";
$serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN;
$serverCtx = stream_context_create(['ssl' => [
'local_cert' => '%s',
'local_pk' => '%s',
]]);
$sock = stream_socket_server($serverUri, $errno, $errstr, $serverFlags, $serverCtx);
phpt_notify_server_start($sock);
$link = stream_socket_accept($sock);
CODE;
$clientCode = <<<'CODE'
$serverUri = "ssl://{{ ADDR }}";
$clientFlags = STREAM_CLIENT_CONNECT;
$clientCtx = stream_context_create(['ssl' => [
'verify_peer' => false,
'verify_peer_name' => false
]]);
@stream_socket_client($serverUri, $errno, $errstr, 2, $clientFlags, $clientCtx);
CODE;
$serverCode = sprintf($serverCodeTemplate, $baseDirCertFile . "\0test", $baseDirPkFile);
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
?>
--EXPECTF--
PHP Warning: stream_socket_accept(): Path for local_cert in ssl stream context option must not contain any null bytes in %s
PHP Warning: stream_socket_accept(): Accept failed: Cannot enable crypto in %s
PHP Warning: stream_socket_accept(): Unable to get real path of certificate file `%scert.crt' in %s
PHP Warning: stream_socket_accept(): Failed to enable crypto in %s