facebook / facebook/hhvm

stream_socket_client could not create peer certificate in the context option

Open
#5,851 5 comments 0 reactions 0 assignees View on GitHub
php5 incompatibility
Dominant language
C++
Stars
18.7k
Forks
3.1k
Avg merge
1h 47m
Merged PRs (30d)
2

Description

Although setting both capture_peer_cert/peer_certificate to true, when a stream_socket_client created, it doesn't create peer certificate in context option.

My hhvm edition is 3.9.0-dev and find the same problem in both 3.8.0 and 3.8.1.

``` php

$sslContext = stream_context_create(
array('ssl' => array(
'capture_peer_cert' => true,
'verify_peer' => true,
'cafile' => $this->caBundle(),
))
);
$result = stream_socket_client(
$url, $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $sslContext
);

```

dd($result)

``` php

stream resource @9
wrapper_type: "SSLSocket"
stream_type: "tcp_socket/ssl"
mode: ""
unread_bytes: 0
seekable: false
uri: ""
timed_out: false
blocked: false
eof: false
wrapper_data: null
options: array:1 [
"ssl" => array:3 [
"capture_peer_cert" => true
"verify_peer" => true
"cafile" => "/home/wwwroot/laravel/vendor/pingplusplus/pingpp-php/lib/../data/ca-certificates.crt"
]
]
}

```

In application the peer_certificate is undefined when I try to fetch it.

``` php

$cert = $params['options']['ssl']['peer_certificate'];

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.