ID: 38384
Updated by: [email]iliaa@php.net[/email]
Reported By: ctm at etheon dot net
-Status: Open
+Status: Feedback
Bug Type: Streams related
Operating System: Windows NT
PHP Version: 5.1.4
New Comment:

Please try using this CVS snapshot:

[url]http://snaps.php.net/php5.2-latest.tar.gz[/url]

For Windows:

[url]http://snaps.php.net/win32/php5.2-win32-latest.zip[/url]




Previous Comments:
------------------------------------------------------------------------

[2006-08-08 16:25:10] ctm at etheon dot net

Description:
------------
I'm not entirely sure if this is a bug or not, but when using the
capture_peer_cert SSL context with a normal socket based stream
connection (as opposed to it being asynchronous), I obtain the
peer_certificate easily in the stream's context options.

When using it an asynchronous connection though, even after using
stream select and the likes, I can't seem to capture the peer's
certificate, even though I have the same context as used in the
"normal" connections.

Reproduce code:
---------------
$ctx = stream_context_create ( array ( 'ssl' => array ( 'verify_peer'
=> false, 'capture_peer_cert' => true ) ) ) ;

$socket = stream_socket_client ( $host, $errno, $errstr, $timeout,
STREAM_CLIENT_ASYNC_CONNECT|STREAM_CLIENT_CONNECT, $ctx ) ;

$info = stream_context_get_options ( $socket ) ;

print_r ( $info ) ;

Expected result:
----------------
Array
{
[ssl] => Array
{
verify_peer => ,
capture_peer_cert => 1,
peer_certificate => Resource id #6
}
}

Actual result:
--------------
Array
{
[ssl] => Array
{
verify_peer => ,
capture_peer_cert => 1,
}
}


------------------------------------------------------------------------


--
Edit this bug report at [url]http://bugs.php.net/?id=38384&edit=1[/url]