Skip to content

Commit be50a72

Browse files
committed
Fix ssl stream reneg limit test to print only after first renegotiation
It has been reported that in some setup the test does multiple renegotiations which is allowed.
1 parent 90d8638 commit be50a72

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

ext/openssl/tests/stream_server_reneg_limit.phpt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,18 @@ if(substr(PHP_OS, 0, 3) == 'WIN') {
2222
*/
2323

2424
$serverCode = <<<'CODE'
25+
$printed = false;
2526
$serverUri = "ssl://127.0.0.1:64321";
2627
$serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN;
2728
$serverCtx = stream_context_create(['ssl' => [
2829
'local_cert' => __DIR__ . '/bug54992.pem',
2930
'reneg_limit' => 0,
3031
'reneg_window' => 30,
31-
'reneg_limit_callback' => function($stream) {
32-
var_dump($stream);
32+
'reneg_limit_callback' => function($stream) use (&$printed) {
33+
if (!$printed) {
34+
$printed = true;
35+
var_dump($stream);
36+
}
3337
}
3438
]]);
3539

0 commit comments

Comments
 (0)