summaryrefslogtreecommitdiff
path: root/ext/openssl/tests/bug72333.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/openssl/tests/bug72333.phpt')
-rw-r--r--ext/openssl/tests/bug72333.phpt21
1 files changed, 17 insertions, 4 deletions
diff --git a/ext/openssl/tests/bug72333.phpt b/ext/openssl/tests/bug72333.phpt
index ee146963a2..f57e35cd3d 100644
--- a/ext/openssl/tests/bug72333.phpt
+++ b/ext/openssl/tests/bug72333.phpt
@@ -7,8 +7,10 @@ if (!function_exists("proc_open")) die("skip no proc_open");
?>
--FILE--
<?php
+$certFile = __DIR__ . DIRECTORY_SEPARATOR . 'bug72333.pem.tmp';
+
$serverCode = <<<'CODE'
- $context = stream_context_create(['ssl' => ['local_cert' => __DIR__ . '/bug54992.pem']]);
+ $context = stream_context_create(['ssl' => ['local_cert' => '%s']]);
$flags = STREAM_SERVER_BIND|STREAM_SERVER_LISTEN;
$fp = stream_socket_server("ssl://127.0.0.1:10011", $errornum, $errorstr, $flags, $context);
@@ -31,14 +33,16 @@ $serverCode = <<<'CODE'
}
phpt_wait();
CODE;
+$serverCode = sprintf($serverCode, $certFile);
+$peerName = 'bug72333';
$clientCode = <<<'CODE'
- $context = stream_context_create(['ssl' => ['verify_peer' => false, 'peer_name' => 'bug54992.local']]);
-
+ $context = stream_context_create(['ssl' => ['verify_peer' => false, 'peer_name' => '%s']]);
+
phpt_wait();
$fp = stream_socket_client("ssl://127.0.0.1:10011", $errornum, $errorstr, 3000, STREAM_CLIENT_CONNECT, $context);
stream_set_blocking($fp, false);
-
+
function blocking_fwrite($fp, $buf) {
$write = [$fp];
$total = 0;
@@ -59,9 +63,18 @@ $clientCode = <<<'CODE'
phpt_notify();
echo "done";
CODE;
+$clientCode = sprintf($clientCode, $peerName);
+
+include 'CertificateGenerator.inc';
+$certificateGenerator = new CertificateGenerator();
+$certificateGenerator->saveNewCertAsFileWithKey($peerName, $certFile);
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
?>
+--CLEAN--
+<?php
+@unlink(__DIR__ . DIRECTORY_SEPARATOR . 'bug72333.pem.tmp');
+?>
--EXPECT--
done